… | … | ||
---|---|---|---|
70 | dTHX; /* inefficient, we already have perl_thx, but I see no better way */ | 70 | dTHX; /* inefficient, we already have perl_thx, but I see no better way */ |
71 | struct tctx *ctx; | 71 | struct tctx *ctx; |
72 | 72 | ||
73 | for (;;) | 73 | for (;;) |
74 | { | 74 | { |
75 | /* TODO: should really use some idle time and exit after that */ | ||
75 | X_LOCK (perl_m); | 76 | X_LOCK (perl_m); |
76 | while (!perl_f) | 77 | while (!perl_f) |
77 | X_COND_WAIT (perl_c, perl_m); | 78 | X_COND_WAIT (perl_c, perl_m); |
78 | ctx = perl_f; | 79 | ctx = perl_f; |
79 | perl_f = 0; | 80 | perl_f = 0; |
… | … | ||
209 | ctx->coro = 0; | 210 | ctx->coro = 0; |
210 | } | 211 | } |
211 | X_UNLOCK (wait_m); | 212 | X_UNLOCK (wait_m); |
212 | 213 | ||
213 | void | 214 | void |
214 | tst (int i) | 215 | sleep (NV seconds) |
215 | CODE: | 216 | CODE: |
216 | perlinterp_release (); | 217 | perlinterp_release (); |
217 | usleep (100000 * i); | 218 | usleep (seconds * 1e6); |
218 | perlinterp_acquire (); | 219 | perlinterp_acquire (); |
220 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |