… | |
… | |
13 | sv_fileno (SV *fh) |
13 | sv_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 | |
528 | SV *ev_default_loop (unsigned int flags = 0) |
546 | SV *ev_default_loop (unsigned int flags = 0) |
529 | CODE: |
547 | CODE: |
… | |
… | |
618 | C_ARGS: evapi.default_loop, fd, revents |
636 | C_ARGS: evapi.default_loop, fd, revents |
619 | |
637 | |
620 | void ev_feed_signal_event (SV *signal) |
638 | void 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 | |