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

Comparing EV/EV.xs (file contents):
Revision 1.161 by root, Wed Dec 5 17:18:47 2012 UTC vs.
Revision 1.166 by root, Sat Apr 6 00:05:45 2013 UTC

13sv_fileno (SV *fh) 13sv_fileno (SV *fh)
14{ 14{
15 return s_fileno (fh, 0); 15 return s_fileno (fh, 0);
16} 16}
17 17
18#ifndef GvCV_set
19# define GvCV_set(gv,cv) GvCV (gv) = cv
20#endif
21
18#define EV_STANDALONE 1 22#define EV_STANDALONE 1
19#define EV_PROTOTYPES 1 23#define EV_PROTOTYPES 1
20#define EV_USE_CLOCK_SYSCALL 0 /* as long as we need pthreads anyways... */
21#define EV_USE_NANOSLEEP EV_USE_MONOTONIC 24#define EV_USE_NANOSLEEP EV_USE_MONOTONIC
22#define EV_USE_FLOOR 1 25#define EV_USE_FLOOR 1
23#define EV_API_STATIC 26#define EV_API_STATIC
24#define EV_H <ev.h> 27#define EV_H <ev.h>
25#define EV_CONFIG_H error 28#define EV_CONFIG_H error
382 const_iv (EV_, SIGNAL) 385 const_iv (EV_, SIGNAL)
383 const_iv (EV_, CHILD) 386 const_iv (EV_, CHILD)
384 const_iv (EV_, STAT) 387 const_iv (EV_, STAT)
385 const_iv (EV_, IDLE) 388 const_iv (EV_, IDLE)
386 const_iv (EV_, PREPARE) 389 const_iv (EV_, PREPARE)
387 const_iv (EV_, CHECK) 390 /*const_iv (EV_, CHECK) needs special tretament */
388 const_iv (EV_, EMBED) 391 const_iv (EV_, EMBED)
389 const_iv (EV_, FORK) 392 const_iv (EV_, FORK)
390 const_iv (EV_, CLEANUP) 393 const_iv (EV_, CLEANUP)
391 const_iv (EV_, ASYNC) 394 const_iv (EV_, ASYNC)
392 const_iv (EV_, CUSTOM) 395 const_iv (EV_, CUSTOM)
426#endif 429#endif
427 }; 430 };
428 431
429 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) 432 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
430 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 433 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
434
435 /* since this clashes with perl CHECK blocks, */
436 /* but we are interested in constants, */
437 /* and not blocks, we treat CHECK specially. */
438 {
439 /* the local $^W = 0 takes care of the warning */
440 CV *cv = newCONSTSUB (stash, "CHECK", newSViv (EV_CHECK));
441 /* now we need to re-set the gv, in case it was hijacked */
442 GvCV_set (gv_fetchpv ("EV::CHECK", GV_ADD, SVt_PVCV), cv);
443 }
431 444
432 stash_loop = gv_stashpv ("EV::Loop" , 1); 445 stash_loop = gv_stashpv ("EV::Loop" , 1);
433 stash_watcher = gv_stashpv ("EV::Watcher" , 1); 446 stash_watcher = gv_stashpv ("EV::Watcher" , 1);
434 stash_io = gv_stashpv ("EV::IO" , 1); 447 stash_io = gv_stashpv ("EV::IO" , 1);
435 stash_timer = gv_stashpv ("EV::Timer" , 1); 448 stash_timer = gv_stashpv ("EV::Timer" , 1);
519 532
520 sv_setiv (sv, (IV)&evapi); 533 sv_setiv (sv, (IV)&evapi);
521 SvREADONLY_on (sv); 534 SvREADONLY_on (sv);
522 } 535 }
523#if !defined _WIN32 && !defined _MINIX 536#if !defined _WIN32 && !defined _MINIX
537#if __linux
538 int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle);
539 __register_atfork (0, 0, default_fork, 0);
540#else
524 pthread_atfork (0, 0, default_fork); 541 pthread_atfork (0, 0, default_fork);
542#endif
525#endif 543#endif
526} 544}
527 545
528SV *ev_default_loop (unsigned int flags = 0) 546SV *ev_default_loop (unsigned int flags = 0)
529 CODE: 547 CODE:
602 C_ARGS: evapi.default_loop, interval 620 C_ARGS: evapi.default_loop, interval
603 621
604void ev_set_timeout_collect_interval (NV interval) 622void ev_set_timeout_collect_interval (NV interval)
605 C_ARGS: evapi.default_loop, interval 623 C_ARGS: evapi.default_loop, interval
606 624
607void ev_run (int flags = 0) 625int ev_run (int flags = 0)
608 ALIAS: 626 ALIAS:
609 loop = 1 627 loop = 1
610 C_ARGS: evapi.default_loop, flags 628 C_ARGS: evapi.default_loop, flags
611 629
612void ev_break (int how = EVBREAK_ONE) 630void ev_break (int how = EVBREAK_ONE)
618 C_ARGS: evapi.default_loop, fd, revents 636 C_ARGS: evapi.default_loop, fd, revents
619 637
620void ev_feed_signal_event (SV *signal) 638void ev_feed_signal_event (SV *signal)
621 CODE: 639 CODE:
622{ 640{
623 Signal signum = s_signum (signal); 641 Signal signum = s_signum (signal);
624 CHECK_SIG (signal, signum); 642 CHECK_SIG (signal, signum);
625 643
626 ev_feed_signal_event (evapi.default_loop, signum); 644 ev_feed_signal_event (evapi.default_loop, signum);
627} 645}
628 646
1406 1424
1407unsigned int ev_depth (struct ev_loop *loop) 1425unsigned int ev_depth (struct ev_loop *loop)
1408 ALIAS: 1426 ALIAS:
1409 loop_depth = 1 1427 loop_depth = 1
1410 1428
1411void ev_run (struct ev_loop *loop, int flags = 0) 1429int ev_run (struct ev_loop *loop, int flags = 0)
1412 ALIAS: 1430 ALIAS:
1413 loop = 1 1431 loop = 1
1414 1432
1415void ev_break (struct ev_loop *loop, int how = 1) 1433void ev_break (struct ev_loop *loop, int how = 1)
1416 ALIAS: 1434 ALIAS:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines