… | |
… | |
22 | |
22 | |
23 | #ifndef SvREFCNT_inc_NN |
23 | #ifndef SvREFCNT_inc_NN |
24 | #define SvREFCNT_inc_NN(sv) SvREFCNT_inc (sv) |
24 | #define SvREFCNT_inc_NN(sv) SvREFCNT_inc (sv) |
25 | #endif |
25 | #endif |
26 | |
26 | |
|
|
27 | #define RECURSION_CHECK 0 |
|
|
28 | |
27 | static X_TLS_DECLARE(current_key); |
29 | static X_TLS_DECLARE(current_key); |
|
|
30 | #if RECURSION_CHECK |
|
|
31 | static X_TLS_DECLARE(check_key); |
|
|
32 | #endif |
|
|
33 | |
28 | |
34 | |
29 | static s_epipe ep; |
35 | static s_epipe ep; |
30 | static void *perl_thx; |
36 | static void *perl_thx; |
31 | static sigset_t cursigset, fullsigset; |
37 | static sigset_t cursigset, fullsigset; |
32 | |
38 | |
… | |
… | |
173 | } |
179 | } |
174 | |
180 | |
175 | static void |
181 | static void |
176 | pmapi_release (void) |
182 | pmapi_release (void) |
177 | { |
183 | { |
|
|
184 | #if RECURSION_CHECK |
|
|
185 | if (X_TLS_GET (check_key)) |
|
|
186 | croak ("perlinterp_release () called without valid perl context"); |
|
|
187 | |
|
|
188 | X_TLS_SET (check_key, &check_key); |
|
|
189 | #endif |
|
|
190 | |
178 | if (! ((thread_enable ? thread_enable : global_enable) & 1)) |
191 | if (! ((thread_enable ? thread_enable : global_enable) & 1)) |
179 | { |
192 | { |
180 | X_TLS_SET (current_key, 0); |
193 | X_TLS_SET (current_key, 0); |
181 | return; |
194 | return; |
182 | } |
195 | } |
… | |
… | |
208 | static void |
221 | static void |
209 | pmapi_acquire (void) |
222 | pmapi_acquire (void) |
210 | { |
223 | { |
211 | int jeret; |
224 | int jeret; |
212 | struct tctx *ctx = X_TLS_GET (current_key); |
225 | struct tctx *ctx = X_TLS_GET (current_key); |
|
|
226 | |
|
|
227 | #if RECURSION_CHECK |
|
|
228 | if (X_TLS_GET (check_key) != &check_key) |
|
|
229 | croak ("perlinterp_acquire () called with valid perl context"); |
|
|
230 | |
|
|
231 | X_TLS_SET (check_key, 0); |
|
|
232 | #endif |
213 | |
233 | |
214 | if (!ctx) |
234 | if (!ctx) |
215 | return; |
235 | return; |
216 | |
236 | |
217 | X_LOCK (acquire_m); |
237 | X_LOCK (acquire_m); |
… | |
… | |
241 | |
261 | |
242 | PROTOTYPES: DISABLE |
262 | PROTOTYPES: DISABLE |
243 | |
263 | |
244 | BOOT: |
264 | BOOT: |
245 | { |
265 | { |
246 | #ifndef _WIN32 |
266 | #ifndef _WIN32 |
247 | sigfillset (&fullsigset); |
267 | sigfillset (&fullsigset); |
248 | #endif |
268 | #endif |
249 | |
269 | |
250 | X_TLS_INIT (current_key); |
270 | X_TLS_INIT (current_key); |
|
|
271 | #if RECURSION_CHECK |
|
|
272 | X_TLS_INIT (check_key); |
|
|
273 | #endif |
251 | |
274 | |
252 | if (s_epipe_new (&ep)) |
275 | if (s_epipe_new (&ep)) |
253 | croak ("Coro::Multicore: unable to initialise event pipe.\n"); |
276 | croak ("Coro::Multicore: unable to initialise event pipe.\n"); |
254 | |
277 | |
255 | perl_thx = PERL_GET_CONTEXT; |
278 | perl_thx = PERL_GET_CONTEXT; |