summaryrefslogtreecommitdiff
path: root/ext/Thread/Thread.xs
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1998-10-20 15:01:20 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1998-10-20 15:01:20 +0000
commit0d85d8777a6ec9fdcc93593180474ebff6fbbccb (patch)
treeb7a90ec24c4eeb104282c17fe156d049c6fbbf70 /ext/Thread/Thread.xs
parentfe572743bdc94988ae47d8a129c5f974e72052a1 (diff)
downloadperl-0d85d8777a6ec9fdcc93593180474ebff6fbbccb.tar.gz
OLD_PTHREADS_API reorganizing.
p4raw-id: //depot/cfgperl@2028
Diffstat (limited to 'ext/Thread/Thread.xs')
-rw-r--r--ext/Thread/Thread.xs36
1 files changed, 6 insertions, 30 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs
index 84f9f57fc5..0c589a95ad 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -230,9 +230,7 @@ newthread (SV *startsv, AV *initargs, char *classname)
static int attr_inited = 0;
sigset_t fullmask, oldmask;
#endif
-#ifdef PTHREAD_SETDETACHSTATE_ARG2_POINTER
static int attr_joinable = ATTR_JOINABLE;
-#endif
savethread = thr;
thr = new_struct_thread(thr);
@@ -259,39 +257,17 @@ newthread (SV *startsv, AV *initargs, char *classname)
err = 0;
if (!attr_inited) {
attr_inited = 1;
-#ifdef OLD_PTHREADS_API
- err = pthread_attr_create(&attr);
-#else
err = pthread_attr_init(&attr);
-#endif
-#ifdef OLD_PTHREADS_API
-#ifdef VMS
-/* This is available with the old pthreads API, but only with */
-/* DecThreads (VMS and Digital Unix (which has and uses the new one)) */
- if (err == 0)
- err = pthread_attr_setdetach_np(&attr, ATTR_JOINABLE);
-#endif
-#else /* !defined(VMS) */
-#ifdef ATTR_JOINABLE
+# ifdef PTHREAD_ATTR_SETDETACHSTATE
if (err == 0)
- err = pthread_attr_setdetachstate(&attr, ATTR_JOINABLE);
-#else /* !defined(ATTR_JOINABLE) */
-#ifdef __UNDETACHED
- if (err == 0)
- err = pthread_attr_setdetachstate(&attr, &__undetached);
-#else /* !defined(__UNDETACHED) */
+ err = PTHREAD_ATTR_SETDETACHSTATE(&attr, attr_joinable);
+
+# else
croak("panic: can't pthread_attr_setdetachstate");
-#endif /* __UNDETACHED */
-#endif /* ATTR_JOINABLE */
-#endif /* VMS */
-#endif /* OLD_PTHREADS_API */
+# endif
}
if (err == 0)
-#ifdef OLD_PTHREADS_API
- err = pthread_create(&thr->self, attr, threadstart, (void*) thr);
-#else
- err = pthread_create(&thr->self, &attr, threadstart, (void*) thr);
-#endif
+ err = PTHREAD_CREATE(&thr->self, attr, threadstart, (void*) thr);
/* Go */
MUTEX_UNLOCK(&thr->mutex);
#endif