ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/xthread.h
(Generate patch)

Comparing libeio/xthread.h (file contents):
Revision 1.1 by root, Sat May 10 17:16:39 2008 UTC vs.
Revision 1.2 by root, Mon May 12 12:36:21 2008 UTC

53#define X_THREAD_ATFORK(a,b,c) 53#define X_THREAD_ATFORK(a,b,c)
54 54
55static int 55static int
56thread_create (thread_t *tid, void *(*proc)(void *), void *arg) 56thread_create (thread_t *tid, void *(*proc)(void *), void *arg)
57{ 57{
58 int res;
58 pthread_attr_t attr; 59 pthread_attr_t attr;
59 60
60 pthread_attr_init (&attr); 61 pthread_attr_init (&attr);
61 pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); 62 pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
62 63
63 return pthread_create (tid, &attr, proc, arg) == 0; 64 res = pthread_create (tid, &attr, proc, arg) == 0;
65
66 pthread_attr_destroy (&attr);
67
68 return res;
64} 69}
65 70
66#define respipe_read(a,b,c) PerlSock_recv ((a), (b), (c), 0) 71#define respipe_read(a,b,c) PerlSock_recv ((a), (b), (c), 0)
67#define respipe_write(a,b,c) send ((a), (b), (c), 0) 72#define respipe_write(a,b,c) send ((a), (b), (c), 0)
68#define respipe_close(a) PerlSock_closesocket ((a)) 73#define respipe_close(a) PerlSock_closesocket ((a))
129 134
130 pthread_sigmask (SIG_SETMASK, &fullsigset, &oldsigset); 135 pthread_sigmask (SIG_SETMASK, &fullsigset, &oldsigset);
131 retval = pthread_create (tid, &attr, proc, arg) == 0; 136 retval = pthread_create (tid, &attr, proc, arg) == 0;
132 pthread_sigmask (SIG_SETMASK, &oldsigset, 0); 137 pthread_sigmask (SIG_SETMASK, &oldsigset, 0);
133 138
139 pthread_attr_destroy (&attr);
140
134 return retval; 141 return retval;
135} 142}
136 143
137#define respipe_read(a,b,c) read ((a), (b), (c)) 144#define respipe_read(a,b,c) read ((a), (b), (c))
138#define respipe_write(a,b,c) write ((a), (b), (c)) 145#define respipe_write(a,b,c) write ((a), (b), (c))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines