1 | #ifndef _WIN32 |
|
|
2 | /* most win32 perls are beyond fixing, requiring dTHX */ |
1 | /* most win32 perls are beyond fixing, requiring dTHX */ |
3 | /* even for ISO-C functions such as malloc. avoid! avoid! avoid! */ |
2 | /* even for ISO-C functions such as malloc. avoid! avoid! avoid! */ |
|
|
3 | /* and fail to define numerous symbols, but still overrwide them */ |
|
|
4 | /* with non-working versions (e.g. setjmp). */ |
|
|
5 | #ifdef _WIN32 |
|
|
6 | /*# define PERL_CORE 1 fixes some, breaks others */ |
|
|
7 | #else |
4 | # define PERL_NO_GET_CONTEXT |
8 | # define PERL_NO_GET_CONTEXT |
5 | #endif |
9 | #endif |
6 | |
10 | |
7 | #include "EXTERN.h" |
11 | #include "EXTERN.h" |
8 | #include "perl.h" |
12 | #include "perl.h" |
… | |
… | |
198 | X_TLS_SET (current_key, 0); |
202 | X_TLS_SET (current_key, 0); |
199 | return; |
203 | return; |
200 | } |
204 | } |
201 | |
205 | |
202 | struct tctx *ctx = tctx_get (); |
206 | struct tctx *ctx = tctx_get (); |
203 | ctx->coro = SvREFCNT_inc_NN (CORO_CURRENT); |
207 | ctx->coro = SvREFCNT_inc_simple_NN (CORO_CURRENT); |
204 | ctx->wait_f = 0; |
208 | ctx->wait_f = 0; |
205 | |
209 | |
206 | X_TLS_SET (current_key, ctx); |
210 | X_TLS_SET (current_key, ctx); |
207 | pthread_sigmask (SIG_SETMASK, &fullsigset, &cursigset); |
211 | pthread_sigmask (SIG_SETMASK, &fullsigset, &cursigset); |
208 | |
212 | |
… | |
… | |
356 | |
360 | |
357 | void |
361 | void |
358 | sleep (NV seconds) |
362 | sleep (NV seconds) |
359 | CODE: |
363 | CODE: |
360 | perlinterp_release (); |
364 | perlinterp_release (); |
361 | usleep (seconds * 1e6); |
365 | { |
|
|
366 | int nsec = seconds; |
|
|
367 | if (nsec) sleep (nsec); |
|
|
368 | nsec = (seconds - nsec) * 1e9; |
|
|
369 | if (nsec) usleep (nsec); |
|
|
370 | } |
362 | perlinterp_acquire (); |
371 | perlinterp_acquire (); |
363 | |
372 | |