summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2008-05-12 12:36:21 +0000
committerroot <root>2008-05-12 12:36:21 +0000
commit06f89d3d1a71d10755b66a4c6567412657400abb (patch)
treeca35623e53a0b44931f91075c595bc1d417a5d69
parentacf608862a9af73453ba86c7e587f6137208ca33 (diff)
*** empty log message ***
-rw-r--r--xthread.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/xthread.h b/xthread.h
index f97dbba..dfb8b0d 100644
--- a/xthread.h
+++ b/xthread.h
@@ -55,12 +55,17 @@ typedef pthread_t thread_t;
static int
thread_create (thread_t *tid, void *(*proc)(void *), void *arg)
{
+ int res;
pthread_attr_t attr;
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- return pthread_create (tid, &attr, proc, arg) == 0;
+ res = pthread_create (tid, &attr, proc, arg) == 0;
+
+ pthread_attr_destroy (&attr);
+
+ return res;
}
#define respipe_read(a,b,c) PerlSock_recv ((a), (b), (c), 0)
@@ -131,6 +136,8 @@ thread_create (thread_t *tid, void *(*proc)(void *), void *arg)
retval = pthread_create (tid, &attr, proc, arg) == 0;
pthread_sigmask (SIG_SETMASK, &oldsigset, 0);
+ pthread_attr_destroy (&attr);
+
return retval;
}