From 414f4bd7e70d94025576d9264c86da63c506f6ca Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 13 Aug 2003 15:10:53 +0000 Subject: Bug fixes plus adaptation to current MinGW/MsysDTK environment. Changes to tests/benchmarks. --- ptw32_threadStart.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'ptw32_threadStart.c') 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 -static terminate_function ptw32_oldTerminate; +# include #else -#include -static terminate_handler ptw32_oldTerminate; +# if defined(__GNUC__) && __GNUC__ < 3 +# include +# else +# include + using std::terminate_handler; + using std::terminate; + using std::set_terminate; +# endif + typedef terminate_handler terminate_function; #endif -#if 0 -#include -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); -- cgit v1.2.3