… | |
… | |
53 | #define X_THREAD_ATFORK(a,b,c) |
53 | #define X_THREAD_ATFORK(a,b,c) |
54 | |
54 | |
55 | static int |
55 | static int |
56 | thread_create (thread_t *tid, void *(*proc)(void *), void *arg) |
56 | thread_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)) |