summaryrefslogtreecommitdiff
path: root/private.c
diff options
context:
space:
mode:
Diffstat (limited to 'private.c')
-rw-r--r--private.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/private.c b/private.c
index 4ae12e8..d7b44c9 100644
--- a/private.c
+++ b/private.c
@@ -121,6 +121,8 @@ _pthread_threadStart (ThreadParms * threadParms)
pthread_setspecific (_pthread_selfThreadKey, tid);
+#ifdef _WIN32
+
__try
{
/*
@@ -138,6 +140,41 @@ _pthread_threadStart (ThreadParms * threadParms)
status = -1;
}
+#else /* _WIN32 */
+
+#ifdef __cplusplus
+
+ try
+ {
+ /*
+ * Run the caller's routine;
+ */
+ (*start) (arg);
+ status = 0;
+ }
+ catch (...)
+ {
+ /*
+ * A system unexpected exception had occurred running the user's
+ * routine. We get control back within this block.
+ */
+ status = -1;
+ }
+
+#else /* __cplusplus */
+
+#error Warning: Compile __FILE__ as C++ or thread cancellation will not work.
+
+ /*
+ * Run the caller's routine;
+ */
+ (*start) (arg);
+ status = 0;
+
+#endif /* __cplusplus */
+
+#endif /* _WIN32 */
+
pthread_exit ((void *) status);
return ((void *) status);