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

Comparing EV/EV.xs (file contents):
Revision 1.146 by root, Sun Oct 24 20:05:43 2010 UTC vs.
Revision 1.151 by root, Thu Dec 30 07:28:47 2010 UTC

208 208
209 if (expect_true (sv_events_cache)) 209 if (expect_true (sv_events_cache))
210 { 210 {
211 sv_events = sv_events_cache; sv_events_cache = 0; 211 sv_events = sv_events_cache; sv_events_cache = 0;
212 SvIV_set (sv_events, revents); 212 SvIV_set (sv_events, revents);
213 SvIOK_only (sv_events);
213 } 214 }
214 else 215 else
215 { 216 {
216 sv_events = newSViv (revents); 217 sv_events = newSViv (revents);
217 SvREADONLY_on (sv_events); 218 SvREADONLY_on (sv_events);
341 croak ("illegal file descriptor or filehandle (either no attached file descriptor or illegal value): %s", SvPV_nolen (fh)); 342 croak ("illegal file descriptor or filehandle (either no attached file descriptor or illegal value): %s", SvPV_nolen (fh));
342 343
343#define CHECK_SIG(sv,num) if ((num) < 0) \ 344#define CHECK_SIG(sv,num) if ((num) < 0) \
344 croak ("illegal signal number or name: %s", SvPV_nolen (sv)); 345 croak ("illegal signal number or name: %s", SvPV_nolen (sv));
345 346
347static void
348default_fork (void)
349{
350 ev_loop_fork (EV_DEFAULT_UC);
351}
352
346///////////////////////////////////////////////////////////////////////////// 353/////////////////////////////////////////////////////////////////////////////
347// XS interface functions 354// XS interface functions
348 355
349MODULE = EV PACKAGE = EV PREFIX = ev_ 356MODULE = EV PACKAGE = EV PREFIX = ev_
350 357
365 const_iv (EV_, UNDEF) 372 const_iv (EV_, UNDEF)
366 const_iv (EV_, NONE) 373 const_iv (EV_, NONE)
367 const_iv (EV_, READ) 374 const_iv (EV_, READ)
368 const_iv (EV_, WRITE) 375 const_iv (EV_, WRITE)
369 const_iv (EV_, IO) 376 const_iv (EV_, IO)
370 const_iv (EV_, TIMEOUT) 377 const_iv (EV_, TIMER)
371 const_iv (EV_, PERIODIC) 378 const_iv (EV_, PERIODIC)
372 const_iv (EV_, SIGNAL) 379 const_iv (EV_, SIGNAL)
373 const_iv (EV_, CHILD) 380 const_iv (EV_, CHILD)
374 const_iv (EV_, STAT) 381 const_iv (EV_, STAT)
375 const_iv (EV_, IDLE) 382 const_iv (EV_, IDLE)
397 const_iv (EV, BACKEND_ALL) 404 const_iv (EV, BACKEND_ALL)
398 const_iv (EV, FLAG_AUTO) 405 const_iv (EV, FLAG_AUTO)
399 const_iv (EV, FLAG_FORKCHECK) 406 const_iv (EV, FLAG_FORKCHECK)
400 const_iv (EV, FLAG_SIGNALFD) 407 const_iv (EV, FLAG_SIGNALFD)
401 const_iv (EV, FLAG_NOENV) 408 const_iv (EV, FLAG_NOENV)
402 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */
403 const_iv (EV, FLAG_NOINOTIFY) 409 const_iv (EV, FLAG_NOINOTIFY)
404 410
405 const_iv (EV_, VERSION_MAJOR) 411 const_iv (EV_, VERSION_MAJOR)
406 const_iv (EV_, VERSION_MINOR) 412 const_iv (EV_, VERSION_MINOR)
407#if EV_COMPAT3 413#if EV_COMPAT3
414 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */
408 const_iv (EV_, TIMER) 415 const_iv (EV_, TIMEOUT)
409
410 const_iv (EV, LOOP_NONBLOCK) 416 const_iv (EV, LOOP_NONBLOCK)
411 const_iv (EV, LOOP_ONESHOT) 417 const_iv (EV, LOOP_ONESHOT)
412
413 const_iv (EV, UNLOOP_CANCEL) 418 const_iv (EV, UNLOOP_CANCEL)
414 const_iv (EV, UNLOOP_ONE) 419 const_iv (EV, UNLOOP_ONE)
415 const_iv (EV, UNLOOP_ALL) 420 const_iv (EV, UNLOOP_ALL)
416#endif 421#endif
417 }; 422 };
509 514
510 sv_setiv (sv, (IV)&evapi); 515 sv_setiv (sv, (IV)&evapi);
511 SvREADONLY_on (sv); 516 SvREADONLY_on (sv);
512 } 517 }
513#if !defined(_WIN32) && !defined(_MINIX) 518#if !defined(_WIN32) && !defined(_MINIX)
514 pthread_atfork (0, 0, ev_default_fork); 519 pthread_atfork (0, 0, default_fork);
515#endif 520#endif
516} 521}
517 522
518SV *ev_default_loop (unsigned int flags = 0) 523SV *ev_default_loop (unsigned int flags = 0)
519 CODE: 524 CODE:
754 ev_stat_set (RETVAL, SvPVbyte_nolen (e_fh (RETVAL)), interval); 759 ev_stat_set (RETVAL, SvPVbyte_nolen (e_fh (RETVAL)), interval);
755 if (!ix) START (stat, RETVAL); 760 if (!ix) START (stat, RETVAL);
756 OUTPUT: 761 OUTPUT:
757 RETVAL 762 RETVAL
758 763
764#ifndef EV_NO_LOOPS
765
759ev_embed *embed (struct ev_loop *loop, SV *cb = 0) 766ev_embed *embed (struct ev_loop *loop, SV *cb = 0)
760 ALIAS: 767 ALIAS:
761 embed_ns = 1 768 embed_ns = 1
762 CODE: 769 CODE:
763{ 770{
769 ev_embed_set (RETVAL, loop); 776 ev_embed_set (RETVAL, loop);
770 if (!ix) START (embed, RETVAL); 777 if (!ix) START (embed, RETVAL);
771} 778}
772 OUTPUT: 779 OUTPUT:
773 RETVAL 780 RETVAL
781
782#endif
774 783
775ev_async *async (SV *cb) 784ev_async *async (SV *cb)
776 ALIAS: 785 ALIAS:
777 async_ns = 1 786 async_ns = 1
778 CODE: 787 CODE:
1321 CODE: 1330 CODE:
1322 RETVAL = boolSV (ev_async_pending (w)); 1331 RETVAL = boolSV (ev_async_pending (w));
1323 OUTPUT: 1332 OUTPUT:
1324 RETVAL 1333 RETVAL
1325 1334
1335#ifndef EV_NO_LOOPS
1336
1326MODULE = EV PACKAGE = EV::Loop PREFIX = ev_ 1337MODULE = EV PACKAGE = EV::Loop PREFIX = ev_
1327 1338
1328SV *new (SV *klass, unsigned int flags = 0) 1339SV *new (SV *klass, unsigned int flags = 0)
1329 CODE: 1340 CODE:
1330{ 1341{
1569 SvOK (timeout) ? SvNV (timeout) : -1., 1580 SvOK (timeout) ? SvNV (timeout) : -1.,
1570 e_once_cb, 1581 e_once_cb,
1571 newSVsv (cb) 1582 newSVsv (cb)
1572 ); 1583 );
1573 1584
1585#endif
1586

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines