summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorrpj <rpj>2000-01-04 10:19:28 +0000
committerrpj <rpj>2000-01-04 10:19:28 +0000
commita378d97dc9d9eadaef00a9f01816948db5f3a796 (patch)
tree654435cc0a85156c2a9b4793ab7d8e0da8424e32 /pthread.h
parent27d833666dfd72cc6e74c3900d3e8e66321bea3a (diff)
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
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h50
1 files changed, 40 insertions, 10 deletions
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 */