diff options
author | rpj <rpj> | 2003-08-13 15:10:53 +0000 |
---|---|---|
committer | rpj <rpj> | 2003-08-13 15:10:53 +0000 |
commit | 414f4bd7e70d94025576d9264c86da63c506f6ca (patch) | |
tree | ed0d8de3bd5fbccd0191b3e6cc1e0d86ebe8ff97 /ptw32_threadStart.c | |
parent | 614c09bf607cf77c70c7435cd615c9f8b684bc5e (diff) |
Bug fixes plus adaptation to current MinGW/MsysDTK environment. Changes to tests/benchmarks.
Diffstat (limited to 'ptw32_threadStart.c')
-rw-r--r-- | ptw32_threadStart.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/ptw32_threadStart.c b/ptw32_threadStart.c index 96cadf9..79b793b 100644 --- a/ptw32_threadStart.c +++ b/ptw32_threadStart.c @@ -82,37 +82,32 @@ ExceptionFilter (EXCEPTION_POINTERS * ep, DWORD * ei) #elif defined(__CLEANUP_CXX) #if defined(_MSC_VER) -#include <eh.h> -static terminate_function ptw32_oldTerminate; +# include <eh.h> #else -#include <new.h> -static terminate_handler ptw32_oldTerminate; +# if defined(__GNUC__) && __GNUC__ < 3 +# include <new.h> +# else +# include <new> + using std::terminate_handler; + using std::terminate; + using std::set_terminate; +# endif + typedef terminate_handler terminate_function; #endif -#if 0 -#include <stdio.h> -static pthread_mutex_t termLock = PTHREAD_MUTEX_INITIALIZER; -#endif +static terminate_function ptw32_oldTerminate; void ptw32_terminate () { pthread_t self = pthread_self(); -#if 0 - FILE * fp; - pthread_mutex_lock(&termLock); - fp = fopen("pthread.log", "a"); - fprintf(fp, "Terminate\n"); - fclose(fp); - pthread_mutex_unlock(&termLock); -#endif set_terminate(ptw32_oldTerminate); (void) pthread_mutex_destroy(&self->cancelLock); ptw32_callUserDestroyRoutines(self); terminate(); } -#endif /* _MSC_VER */ +#endif #if ! defined (__MINGW32__) || defined (__MSVCRT__) unsigned __stdcall @@ -263,12 +258,7 @@ ptw32_threadStart (void * vthreadParms) * supplied function. */ -#if defined(_MSC_VER) terminate_function term_func = set_terminate(0); -#else - terminate_handler term_func = set_terminate(0); -#endif - set_terminate(term_func); if (term_func != 0) { @@ -323,7 +313,6 @@ ptw32_threadStart (void * vthreadParms) #endif /* __CLEANUP_C */ #endif /* __CLEANUP_SEH */ -#if 1 if (self->detachState == PTHREAD_CREATE_DETACHED) { /* @@ -345,9 +334,6 @@ ptw32_threadStart (void * vthreadParms) { ptw32_callUserDestroyRoutines (self); } -#else - ptw32_callUserDestroyRoutines (self); -#endif #if ! defined (__MINGW32__) || defined (__MSVCRT__) _endthreadex ((unsigned) status); |