… | |
… | |
75 | *tid = 0; |
75 | *tid = 0; |
76 | CreateThread (0, 4096, proc, arg, 0, tid); |
76 | CreateThread (0, 4096, proc, arg, 0, tid); |
77 | return !!*tid; |
77 | return !!*tid; |
78 | } |
78 | } |
79 | |
79 | |
80 | int Perl_my_socketpair (int family, int type, int protocol, int fd[2]); |
80 | #define respipe_read(a,b,c) PerlSock_recv ((a), (b), (c), 0) |
81 | |
81 | #define respipe_write(a,b,c) send ((a), (b), (c), 0) |
82 | static int |
82 | #define respipe_close(a) PerlSock_closesocket ((a)) |
83 | create_pipe (int fd[2]) |
|
|
84 | { |
|
|
85 | int arg = 1; |
|
|
86 | Perl_my_socketpair (AF_UNIX, SOCK_STREAM, 0, fd); |
|
|
87 | ioctlsocket (fd [0], FIONBIO, &arg); |
|
|
88 | ioctlsocket (fd [1], FIONBIO, &arg); |
|
|
89 | |
|
|
90 | return 1; |
|
|
91 | } |
|
|
92 | |
83 | |
93 | #else |
84 | #else |
94 | ///////////////////////////////////////////////////////////////////////////// |
85 | ///////////////////////////////////////////////////////////////////////////// |
95 | |
86 | |
96 | /* solaris */ |
87 | /* solaris */ |
… | |
… | |
105 | |
96 | |
106 | #include <unistd.h> |
97 | #include <unistd.h> |
107 | #include <fcntl.h> |
98 | #include <fcntl.h> |
108 | #include <signal.h> |
99 | #include <signal.h> |
109 | #include <pthread.h> |
100 | #include <pthread.h> |
110 | |
|
|
111 | #ifndef PTHREAD_STACK_MIN |
|
|
112 | /* care for broken platforms, e.g. windows */ |
|
|
113 | # define PTHREAD_STACK_MIN 16384 |
|
|
114 | #endif |
|
|
115 | |
101 | |
116 | typedef pthread_mutex_t mutex_t; |
102 | typedef pthread_mutex_t mutex_t; |
117 | #if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
103 | #if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
118 | # define X_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
104 | # define X_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
119 | #else |
105 | #else |
… | |
… | |
152 | pthread_sigmask (SIG_SETMASK, &oldsigset, 0); |
138 | pthread_sigmask (SIG_SETMASK, &oldsigset, 0); |
153 | |
139 | |
154 | return retval; |
140 | return retval; |
155 | } |
141 | } |
156 | |
142 | |
157 | static int |
143 | #define respipe_read(a,b,c) read ((a), (b), (c)) |
158 | create_pipe (int fd[2]) |
144 | #define respipe_write(a,b,c) write ((a), (b), (c)) |
159 | { |
145 | #define respipe_close(a) close ((a)) |
160 | if (pipe (fd) |
|
|
161 | || fcntl (fd [0], F_SETFL, O_NONBLOCK) |
|
|
162 | || fcntl (fd [1], F_SETFL, O_NONBLOCK)) |
|
|
163 | return 0; |
|
|
164 | |
|
|
165 | return 1; |
|
|
166 | } |
|
|
167 | |
146 | |
168 | #endif |
147 | #endif |
169 | |
148 | |
170 | #if __ia64 |
|
|
171 | # define STACKSIZE 65536 |
|
|
172 | #elif __i386 || __x86_64 /* 16k is unreasonably high :( */ |
|
|
173 | # define STACKSIZE PTHREAD_STACK_MIN |
|
|
174 | #else |
|
|
175 | # define STACKSIZE 16384 |
|
|
176 | #endif |
|
|
177 | |
149 | |
178 | |
150 | |