ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro-Multicore/Multicore.xs
(Generate patch)

Comparing Coro-Multicore/Multicore.xs (file contents):
Revision 1.1 by root, Sat Jun 27 17:59:10 2015 UTC vs.
Revision 1.2 by root, Sat Jun 27 18:13:34 2015 UTC

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
213void 214void
214tst (int i) 215sleep (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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines