From 6237335fec273ac2b00c32609a8eef91c6ec7473 Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 23 Jan 1999 06:58:47 +0000 Subject: Fixing problems building with GNU compilers: Sun Jan 24 01:34:52 1999 Ross Johnson * semaphore.c (sem_wait): Remove second arg to pthreadCancelableWait() call. Fri Jan 22 14:31:59 1999 Ross Johnson * Makefile.in (CFLAGS): Remove -fhandle-exceptions. Not needed with egcs. Add -g for debugging. * create.c (pthread_create): Replace __stdcall with PT_STDCALL macro. This is a hack and must be fixed. * misc.c (CancelableWait): Remove redundant statement. * mutex.c (pthread_mutexattr_init): Cast calloc return value. * misc.c (CancelableWait): Add cast. (pthread_self): Add cast. * exit.c (pthread_exit): Add cast. * condvar.c (pthread_condattr_init): Cast calloc return value. * cleanup.c: Reorganise conditional compilation. * attr.c (pthread_attr_init): Remove unused 'result'. Cast malloc return value. * private.c (_pthread_callUserDestroyRoutines): Redo conditional compilation. * misc.c (CancelableWait): C++ version uses 'throw'. * cancel.c (pthread_testcancel): Ditto. * implement.h (class pthread_exception): Define for C++. * pthread.h: Fix C, C++, and Win32 SEH condition compilation mayhem around pthread_cleanup_* defines. C++ version now uses John Bossom's cleanup handlers. (pthread_attr_t): Make 'valid' unsigned. Define '_timeb' as 'timeb' for Ming32. Define PT_STDCALL as nothing for Mingw32. May be temporary. * cancel.c (pthread_testcancel): Cast return value. --- misc.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index 49a71dd..f57d738 100644 --- a/misc.c +++ b/misc.c @@ -71,7 +71,8 @@ pthread_self (void) * need to ensure there always is a self */ - if ((self = pthread_getspecific (_pthread_selfThreadKey)) == NULL) + if ((self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey)) + == NULL) { /* * Need to create an implicit 'self' for the currently @@ -153,7 +154,8 @@ CancelableWait (HANDLE waitHandle, DWORD timeout) handles[0] = waitHandle; - if ((self = pthread_getspecific (_pthread_selfThreadKey)) != NULL) + if ((self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey)) + != NULL) { /* * Get cancelEvent handle @@ -219,6 +221,9 @@ CancelableWait (HANDLE waitHandle, DWORD timeout) /* * Thread started with pthread_create */ + +#ifdef _MSC_VER + DWORD exceptionInformation[3]; exceptionInformation[0] = (DWORD) (0); @@ -229,10 +234,20 @@ CancelableWait (HANDLE waitHandle, DWORD timeout) 0, 3, exceptionInformation); - } +#else /* _MSC_VER */ + +#ifdef __cplusplus + + throw pthread_exception; + +#endif /* __cplusplus */ + +#endif /* _MSC_VER */ + } - ((void *) -1); + /* Should never get to here. */ + result = EINVAL; break; default: -- cgit v1.2.3