From a378d97dc9d9eadaef00a9f01816948db5f3a796 Mon Sep 17 00:00:00 2001 From: rpj Date: Tue, 4 Jan 2000 10:19:28 +0000 Subject: Main changes (see ChangeLog diff for details and attributions):- - asynchronous cancellation added - attempt to hide internal exceptions from applications - kernel32 load/free problem fixed - new tests - changes only to comments in some tests --- pthread.h | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'pthread.h') diff --git a/pthread.h b/pthread.h index c8076be..bed1ae3 100644 --- a/pthread.h +++ b/pthread.h @@ -285,16 +285,6 @@ struct timespec { #define PT_STDCALL __stdcall #endif - -/* - * This should perhaps be in autoconf or - * possibly fixed in Mingw32 to - * correspond to the Windows headers. - */ -#ifdef __MINGW32__ -#define _timeb timeb -#endif - #ifdef __cplusplus extern "C" { @@ -968,6 +958,46 @@ int * _errno( void ); rand() +#ifdef _MSC_VER +/* + * Get internal SEH tag + */ +DWORD _pthread_get_exception_services_code(void); + +/* + * Redefine the SEH __except keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#define __except(E) \ + __except((GetExceptionCode() == _pthread_get_exception_services_code()) \ + ? EXCEPTION_CONTINUE_SEARCH : (E)) + +#endif + +#ifdef __cplusplus +/* + * Internal exceptions + */ +class Pthread_exception_cancel {}; +class Pthread_exception_exit {}; + +/* + * Redefine the C++ catch keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#define catch(E) \ + catch(Pthread_exception_cancel) \ + { \ + throw; \ + } \ + catch(Pthread_exception_exit) \ + { \ + throw; \ + } \ + catch(E) + +#endif + #ifdef __cplusplus } /* End of extern "C" */ #endif /* __cplusplus */ -- cgit v1.2.3