summaryrefslogtreecommitdiff
path: root/ext/threads/threads.xs
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2001-10-12 18:28:23 +0000
committerArtur Bergman <sky@nanisky.com>2001-10-12 18:28:23 +0000
commitfa26028c8ed1adcf8bc3898ae6ee3ef9254b86af (patch)
tree5ad8bfd0ada4bcecc03992608692264db95f6078 /ext/threads/threads.xs
parent74f0f59828f15458dfb57277ad8876f890f24446 (diff)
downloadperl-fa26028c8ed1adcf8bc3898ae6ee3ef9254b86af.tar.gz
perhaps pthread_attr_t really needs to be set for the old api
p4raw-id: //depot/perl@12412
Diffstat (limited to 'ext/threads/threads.xs')
-rwxr-xr-xext/threads/threads.xs16
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs
index 378127c357..8db1b8878f 100755
--- a/ext/threads/threads.xs
+++ b/ext/threads/threads.xs
@@ -157,7 +157,21 @@ SV* Perl_thread_create(char* class, SV* init_function, SV* params) {
#else
#ifdef OLD_PTHREADS_API
- pthread_create( &thread->thr, (pthread_attr_t)NULL, Perl_thread_run, (void *)thread);
+ {
+ static pthread_attr_t attr;
+ static int attr_inited = 0;
+ sigset_t fullmask, oldmask;
+ static int attr_joinable = PTHREAD_CREATE_JOINABLE;
+ if (!attr_inited) {
+ attr_inited = 1;
+ pthread_attr_init(&attr);
+ }
+# ifdef PTHREAD_ATTR_SETDETACHSTATE
+ PTHREAD_ATTR_SETDETACHSTATE(&attr, attr_joinable);
+# endif
+
+ pthread_create( &thread->thr, attr, Perl_thread_run, (void *)thread);
+ }
#else
pthread_create( &thread->thr, (pthread_attr_t*)NULL, Perl_thread_run, (void *)thread);
#endif