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

Comparing EV/EV.xs (file contents):
Revision 1.124 by root, Mon Jun 29 18:46:52 2009 UTC vs.
Revision 1.136 by root, Tue Mar 16 17:11:48 2010 UTC

1#include "EXTERN.h" 1#include "EXTERN.h"
2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4 4
5/*#include <netinet/in.h>*/
6
7/* fix perl api breakage */ 5/* fix perl api breakage */
8#undef signal 6#undef signal
9#undef sigaction 7#undef sigaction
10 8
9#include "schmorp.h"
10
11/* old API compatibility */
12static int
13sv_fileno (SV *fh)
14{
15 return s_fileno (fh, 0);
16}
17
18#define EV_STANDALONE 1
11#define EV_PROTOTYPES 1 19#define EV_PROTOTYPES 1
12#define EV_USE_NANOSLEEP EV_USE_MONOTONIC 20#define EV_USE_NANOSLEEP EV_USE_MONOTONIC
13#define EV_H <ev.h> 21#define EV_H <ev.h>
22#define EV_CONFIG_H error
14#include "EV/EVAPI.h" 23#include "EV/EVAPI.h"
15 24
16#define EV_SELECT_IS_WINSOCKET 0 25#define EV_SELECT_IS_WINSOCKET 0
17#ifdef _WIN32 26#ifdef _WIN32
18# define EV_SELECT_USE_FD_SET 0 27# define EV_SELECT_USE_FD_SET 0
24 33
25#ifndef _WIN32 34#ifndef _WIN32
26# include <pthread.h> 35# include <pthread.h>
27#endif 36#endif
28 37
29/* 5.10.0 */
30#ifndef SvREFCNT_inc_NN
31# define SvREFCNT_inc_NN(sv) SvREFCNT_inc (sv)
32#endif
33
34/* 5.6.x */
35#ifndef SvRV_set
36# define SvRV_set(a,b) SvRV ((a)) = (b)
37#endif
38
39#define e_loop(w) INT2PTR (struct ev_loop *, SvIVX ((w)->loop)) 38#define e_loop(w) INT2PTR (struct ev_loop *, SvIVX ((w)->loop))
40 39
41#define WFLAG_KEEPALIVE 1 40#define WFLAG_KEEPALIVE 1
42#define WFLAG_UNREFED 2 /* has been unref'ed */ 41#define WFLAG_UNREFED 2 /* has been unref'ed */
43 42
67 REF (w); \ 66 REF (w); \
68 ev_ ## type ## _stop (e_loop (w), w); \ 67 ev_ ## type ## _stop (e_loop (w), w); \
69 } while (0) 68 } while (0)
70 69
71#define RESET(type,w,seta) \ 70#define RESET(type,w,seta) \
72 do { \ 71 do { \
73 int active = ev_is_active (w); \ 72 int active = ev_is_active (w); \
74 if (active) STOP (type, w); \ 73 if (active) STOP (type, w); \
75 ev_ ## type ## _set seta; \ 74 ev_ ## type ## _set seta; \
76 if (active) START (type, w); \ 75 if (active) START (type, w); \
77 } while (0) 76 } while (0)
78 77
79typedef int Signal; 78typedef int Signal;
79
80/* horrible... */
81#define CHECK_SIGNAL_CAN_START(w) \
82 do { \
83 /* dive into the internals of libev to avoid aborting in libev */ \
84 if (signals [(w)->signum - 1].loop \
85 && signals [(w)->signum - 1].loop != e_loop (w)) \
86 croak ("unable to start signal watcher, signal %d already registered in another loop", w->signum); \
87 } while (0)
88
89#define START_SIGNAL(w) \
90 do { \
91 CHECK_SIGNAL_CAN_START (w); \
92 START (signal, w); \
93 } while (0) \
94
95#define RESET_SIGNAL(w,seta) \
96 do { \
97 int active = ev_is_active (w); \
98 if (active) STOP (signal, w); \
99 ev_ ## signal ## _set seta; \
100 if (active) START_SIGNAL (w); \
101 } while (0)
80 102
81static SV *default_loop_sv; 103static SV *default_loop_sv;
82 104
83static struct EVAPI evapi; 105static struct EVAPI evapi;
84 106
96 *stash_check, 118 *stash_check,
97 *stash_embed, 119 *stash_embed,
98 *stash_fork, 120 *stash_fork,
99 *stash_async; 121 *stash_async;
100 122
101#ifndef SIG_SIZE
102/* kudos to Slaven Rezic for the idea */
103static char sig_size [] = { SIG_NUM };
104# define SIG_SIZE (sizeof (sig_size) + 1)
105#endif
106
107static Signal
108sv_signum (SV *sig)
109{
110 Signal signum;
111
112 SvGETMAGIC (sig);
113
114 for (signum = 1; signum < SIG_SIZE; ++signum)
115 if (strEQ (SvPV_nolen (sig), PL_sig_name [signum]))
116 return signum;
117
118 signum = SvIV (sig);
119
120 if (signum > 0 && signum < SIG_SIZE)
121 return signum;
122
123 return -1;
124}
125
126///////////////////////////////////////////////////////////////////////////// 123/////////////////////////////////////////////////////////////////////////////
127// Event 124// Event
128 125
129static void e_cb (EV_P_ ev_watcher *w, int revents); 126static void e_cb (EV_P_ ev_watcher *w, int revents);
130 127
131static int
132sv_fileno (SV *fh)
133{
134 SvGETMAGIC (fh);
135
136 if (SvROK (fh))
137 fh = SvRV (fh);
138
139 if (SvTYPE (fh) == SVt_PVGV)
140 return PerlIO_fileno (IoIFP (sv_2io (fh)));
141
142 if (SvOK (fh) && (SvIV (fh) >= 0) && (SvIV (fh) < 0x7fffffffL))
143 return SvIV (fh);
144
145 return -1;
146}
147
148static SV *
149e_get_cv (SV *cb_sv)
150{
151 HV *st;
152 GV *gvp;
153 CV *cv = sv_2cv (cb_sv, &st, &gvp, 0);
154
155 if (!cv)
156 croak ("EV watcher callback must be a CODE reference");
157
158 return (SV *)cv;
159}
160
161static void * 128static void *
162e_new (int size, SV *cb_sv, SV *loop) 129e_new (int size, SV *cb_sv, SV *loop)
163{ 130{
164 SV *cv = cb_sv ? e_get_cv (cb_sv) : 0; 131 SV *cv = cb_sv ? s_get_cv_croak (cb_sv) : 0;
165 ev_watcher *w; 132 ev_watcher *w;
166 SV *self = NEWSV (0, size); 133 SV *self = NEWSV (0, size);
167 SvPOK_only (self); 134 SvPOK_only (self);
168 SvCUR_set (self, size); 135 SvCUR_set (self, size);
169 136
393 const_iv (EV_, UNDEF) 360 const_iv (EV_, UNDEF)
394 const_iv (EV_, NONE) 361 const_iv (EV_, NONE)
395 const_iv (EV_, READ) 362 const_iv (EV_, READ)
396 const_iv (EV_, WRITE) 363 const_iv (EV_, WRITE)
397 const_iv (EV_, IO) 364 const_iv (EV_, IO)
398 const_iv (EV_, TIMEOUT) 365 const_iv (EV_, TIMEOUT) /* deprecated */
399 const_iv (EV_, TIMER) 366 const_iv (EV_, TIMER)
400 const_iv (EV_, PERIODIC) 367 const_iv (EV_, PERIODIC)
401 const_iv (EV_, SIGNAL) 368 const_iv (EV_, SIGNAL)
402 const_iv (EV_, CHILD) 369 const_iv (EV_, CHILD)
403 const_iv (EV_, STAT) 370 const_iv (EV_, STAT)
421 const_iv (EV, BACKEND_POLL) 388 const_iv (EV, BACKEND_POLL)
422 const_iv (EV, BACKEND_EPOLL) 389 const_iv (EV, BACKEND_EPOLL)
423 const_iv (EV, BACKEND_KQUEUE) 390 const_iv (EV, BACKEND_KQUEUE)
424 const_iv (EV, BACKEND_DEVPOLL) 391 const_iv (EV, BACKEND_DEVPOLL)
425 const_iv (EV, BACKEND_PORT) 392 const_iv (EV, BACKEND_PORT)
393 const_iv (EV, BACKEND_ALL)
426 const_iv (EV, FLAG_AUTO) 394 const_iv (EV, FLAG_AUTO)
395 const_iv (EV, FLAG_FORKCHECK)
396 const_iv (EV, FLAG_SIGNALFD)
427 const_iv (EV, FLAG_NOENV) 397 const_iv (EV, FLAG_NOENV)
398 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */
428 const_iv (EV, FLAG_FORKCHECK) 399 const_iv (EV, FLAG_NOINOTIFY)
429 400
430 const_iv (EV_, VERSION_MAJOR) 401 const_iv (EV_, VERSION_MAJOR)
431 const_iv (EV_, VERSION_MINOR) 402 const_iv (EV_, VERSION_MINOR)
432 }; 403 };
433 404
455 426
456 /* the poor man's shared library emulator */ 427 /* the poor man's shared library emulator */
457 evapi.ver = EV_API_VERSION; 428 evapi.ver = EV_API_VERSION;
458 evapi.rev = EV_API_REVISION; 429 evapi.rev = EV_API_REVISION;
459 evapi.sv_fileno = sv_fileno; 430 evapi.sv_fileno = sv_fileno;
460 evapi.sv_signum = sv_signum; 431 evapi.sv_signum = s_signum;
461 evapi.supported_backends = ev_supported_backends (); 432 evapi.supported_backends = ev_supported_backends ();
462 evapi.recommended_backends = ev_recommended_backends (); 433 evapi.recommended_backends = ev_recommended_backends ();
463 evapi.embeddable_backends = ev_embeddable_backends (); 434 evapi.embeddable_backends = ev_embeddable_backends ();
464 evapi.time_ = ev_time; 435 evapi.time_ = ev_time;
465 evapi.sleep_ = ev_sleep; 436 evapi.sleep_ = ev_sleep;
466 evapi.loop_new = ev_loop_new; 437 evapi.loop_new = ev_loop_new;
467 evapi.loop_destroy = ev_loop_destroy; 438 evapi.loop_destroy = ev_loop_destroy;
468 evapi.loop_fork = ev_loop_fork; 439 evapi.loop_fork = ev_loop_fork;
469 evapi.loop_count = ev_loop_count; 440 evapi.loop_count = ev_loop_count;
441 evapi.loop_depth = ev_loop_depth;
442 evapi.set_userdata = ev_set_userdata;
443 evapi.userdata = ev_userdata;
470 evapi.now = ev_now; 444 evapi.now = ev_now;
471 evapi.now_update = ev_now_update; 445 evapi.now_update = ev_now_update;
472 evapi.suspend = ev_suspend; 446 evapi.suspend = ev_suspend;
473 evapi.resume = ev_resume; 447 evapi.resume = ev_resume;
474 evapi.backend = ev_backend; 448 evapi.backend = ev_backend;
475 evapi.unloop = ev_unloop; 449 evapi.unloop = ev_unloop;
450 evapi.invoke_pending = ev_invoke_pending;
451 evapi.pending_count = ev_pending_count;
452 evapi.set_loop_release_cb = ev_set_loop_release_cb;
453 evapi.set_invoke_pending_cb= ev_set_invoke_pending_cb;
476 evapi.ref = ev_ref; 454 evapi.ref = ev_ref;
477 evapi.unref = ev_unref; 455 evapi.unref = ev_unref;
478 evapi.loop = ev_loop; 456 evapi.loop = ev_loop;
479 evapi.once = ev_once; 457 evapi.once = ev_once;
480 evapi.io_start = ev_io_start; 458 evapi.io_start = ev_io_start;
481 evapi.io_stop = ev_io_stop; 459 evapi.io_stop = ev_io_stop;
482 evapi.timer_start = ev_timer_start; 460 evapi.timer_start = ev_timer_start;
483 evapi.timer_stop = ev_timer_stop; 461 evapi.timer_stop = ev_timer_stop;
484 evapi.timer_again = ev_timer_again; 462 evapi.timer_again = ev_timer_again;
463 evapi.timer_remaining = ev_timer_remaining;
485 evapi.periodic_start = ev_periodic_start; 464 evapi.periodic_start = ev_periodic_start;
486 evapi.periodic_stop = ev_periodic_stop; 465 evapi.periodic_stop = ev_periodic_stop;
487 evapi.signal_start = ev_signal_start; 466 evapi.signal_start = ev_signal_start;
488 evapi.signal_stop = ev_signal_stop; 467 evapi.signal_stop = ev_signal_stop;
489 evapi.idle_start = ev_idle_start; 468 evapi.idle_start = ev_idle_start;
563 C_ARGS: evapi.default_loop 542 C_ARGS: evapi.default_loop
564 543
565unsigned int ev_backend () 544unsigned int ev_backend ()
566 C_ARGS: evapi.default_loop 545 C_ARGS: evapi.default_loop
567 546
547void ev_loop_verify ()
548 C_ARGS: evapi.default_loop
549
568unsigned int ev_loop_count () 550unsigned int ev_loop_count ()
569 C_ARGS: evapi.default_loop 551 C_ARGS: evapi.default_loop
570 552
553unsigned int ev_loop_depth ()
554 C_ARGS: evapi.default_loop
555
571void ev_set_io_collect_interval (NV interval) 556void ev_set_io_collect_interval (NV interval)
572 C_ARGS: evapi.default_loop, interval 557 C_ARGS: evapi.default_loop, interval
573 558
574void ev_set_timeout_collect_interval (NV interval) 559void ev_set_timeout_collect_interval (NV interval)
575 C_ARGS: evapi.default_loop, interval 560 C_ARGS: evapi.default_loop, interval
584 C_ARGS: evapi.default_loop, fd, revents 569 C_ARGS: evapi.default_loop, fd, revents
585 570
586void ev_feed_signal_event (SV *signal) 571void ev_feed_signal_event (SV *signal)
587 CODE: 572 CODE:
588{ 573{
589 Signal signum = sv_signum (signal); 574 Signal signum = s_signum (signal);
590 CHECK_SIG (signal, signum); 575 CHECK_SIG (signal, signum);
591 576
592 ev_feed_signal_event (evapi.default_loop, signum); 577 ev_feed_signal_event (evapi.default_loop, signum);
593} 578}
594 579
580unsigned int ev_pending_count ()
581 C_ARGS: evapi.default_loop
582
583void ev_invoke_pending ()
584 C_ARGS: evapi.default_loop
585
595ev_io *io (SV *fh, int events, SV *cb) 586ev_io *io (SV *fh, int events, SV *cb)
596 ALIAS: 587 ALIAS:
597 io_ns = 1 588 io_ns = 1
589 _ae_io = 2
598 CODE: 590 CODE:
599{ 591{
600 int fd = sv_fileno (fh); 592 int fd = s_fileno (fh, events & EV_WRITE);
601 CHECK_FD (fh, fd); 593 CHECK_FD (fh, fd);
594
595 if (ix == 2)
596 {
597 ix = 0;
598 events = events ? EV_WRITE : EV_READ;
599 }
602 600
603 RETVAL = e_new (sizeof (ev_io), cb, default_loop_sv); 601 RETVAL = e_new (sizeof (ev_io), cb, default_loop_sv);
604 RETVAL->fh = newSVsv (fh); 602 RETVAL->fh = newSVsv (fh);
605 ev_io_set (RETVAL, fd, events); 603 ev_io_set (RETVAL, fd, events);
606 if (!ix) START (io, RETVAL); 604 if (!ix) START (io, RETVAL);
640ev_signal *signal (SV *signal, SV *cb) 638ev_signal *signal (SV *signal, SV *cb)
641 ALIAS: 639 ALIAS:
642 signal_ns = 1 640 signal_ns = 1
643 CODE: 641 CODE:
644{ 642{
645 Signal signum = sv_signum (signal); 643 Signal signum = s_signum (signal);
646 CHECK_SIG (signal, signum); 644 CHECK_SIG (signal, signum);
647 645
648 RETVAL = e_new (sizeof (ev_signal), cb, default_loop_sv); 646 RETVAL = e_new (sizeof (ev_signal), cb, default_loop_sv);
649 ev_signal_set (RETVAL, signum); 647 ev_signal_set (RETVAL, signum);
650 if (!ix) START (signal, RETVAL); 648 if (!ix) START_SIGNAL (RETVAL);
651} 649}
652 OUTPUT: 650 OUTPUT:
653 RETVAL 651 RETVAL
654 652
655ev_idle *idle (SV *cb) 653ev_idle *idle (SV *cb)
741 739
742void once (SV *fh, int events, SV *timeout, SV *cb) 740void once (SV *fh, int events, SV *timeout, SV *cb)
743 CODE: 741 CODE:
744 ev_once ( 742 ev_once (
745 evapi.default_loop, 743 evapi.default_loop,
746 sv_fileno (fh), events, 744 s_fileno (fh, events & EV_WRITE), events,
747 SvOK (timeout) ? SvNV (timeout) : -1., 745 SvOK (timeout) ? SvNV (timeout) : -1.,
748 e_once_cb, 746 e_once_cb,
749 newSVsv (cb) 747 newSVsv (cb)
750 ); 748 );
751 749
785SV *cb (ev_watcher *w, SV *new_cb = 0) 783SV *cb (ev_watcher *w, SV *new_cb = 0)
786 CODE: 784 CODE:
787{ 785{
788 if (items > 1) 786 if (items > 1)
789 { 787 {
790 new_cb = e_get_cv (new_cb); 788 new_cb = s_get_cv_croak (new_cb);
791 RETVAL = newRV_noinc (w->cb_sv); 789 RETVAL = newRV_noinc (w->cb_sv);
792 w->cb_sv = SvREFCNT_inc (new_cb); 790 w->cb_sv = SvREFCNT_inc (new_cb);
793 } 791 }
794 else 792 else
795 RETVAL = newRV_inc (w->cb_sv); 793 RETVAL = newRV_inc (w->cb_sv);
865 e_destroy (w); 863 e_destroy (w);
866 864
867void set (ev_io *w, SV *fh, int events) 865void set (ev_io *w, SV *fh, int events)
868 CODE: 866 CODE:
869{ 867{
870 int fd = sv_fileno (fh); 868 int fd = s_fileno (fh, events & EV_WRITE);
871 CHECK_FD (fh, fd); 869 CHECK_FD (fh, fd);
872 870
873 sv_setsv (w->fh, fh); 871 sv_setsv (w->fh, fh);
874 RESET (io, w, (w, fd, events)); 872 RESET (io, w, (w, fd, events));
875} 873}
877SV *fh (ev_io *w, SV *new_fh = 0) 875SV *fh (ev_io *w, SV *new_fh = 0)
878 CODE: 876 CODE:
879{ 877{
880 if (items > 1) 878 if (items > 1)
881 { 879 {
882 int fd = sv_fileno (new_fh); 880 int fd = s_fileno (new_fh, w->events & EV_WRITE);
883 CHECK_FD (new_fh, fd); 881 CHECK_FD (new_fh, fd);
884 882
885 RETVAL = w->fh; 883 RETVAL = w->fh;
886 w->fh = newSVsv (new_fh); 884 w->fh = newSVsv (new_fh);
887 885
906 904
907MODULE = EV PACKAGE = EV::Signal PREFIX = ev_signal_ 905MODULE = EV PACKAGE = EV::Signal PREFIX = ev_signal_
908 906
909void ev_signal_start (ev_signal *w) 907void ev_signal_start (ev_signal *w)
910 CODE: 908 CODE:
911 START (signal, w); 909 START_SIGNAL (w);
912 910
913void ev_signal_stop (ev_signal *w) 911void ev_signal_stop (ev_signal *w)
914 CODE: 912 CODE:
915 STOP (signal, w); 913 STOP (signal, w);
916 914
920 e_destroy (w); 918 e_destroy (w);
921 919
922void set (ev_signal *w, SV *signal) 920void set (ev_signal *w, SV *signal)
923 CODE: 921 CODE:
924{ 922{
925 Signal signum = sv_signum (signal); 923 Signal signum = s_signum (signal);
926 CHECK_SIG (signal, signum); 924 CHECK_SIG (signal, signum);
927 925
928 RESET (signal, w, (w, signum)); 926 RESET_SIGNAL (w, (w, signum));
929} 927}
930 928
931int signal (ev_signal *w, SV *new_signal = 0) 929int signal (ev_signal *w, SV *new_signal = 0)
932 CODE: 930 CODE:
933{ 931{
934 RETVAL = w->signum; 932 RETVAL = w->signum;
935 933
936 if (items > 1) 934 if (items > 1)
937 { 935 {
938 Signal signum = sv_signum (new_signal); 936 Signal signum = s_signum (new_signal);
939 CHECK_SIG (new_signal, signum); 937 CHECK_SIG (new_signal, signum);
940 938
941 RESET (signal, w, (w, signum)); 939 RESET_SIGNAL (w, (w, signum));
942 } 940 }
943} 941}
944 OUTPUT: 942 OUTPUT:
945 RETVAL 943 RETVAL
946 944
960 INIT: 958 INIT:
961 CHECK_REPEAT (w->repeat); 959 CHECK_REPEAT (w->repeat);
962 CODE: 960 CODE:
963 ev_timer_again (e_loop (w), w); 961 ev_timer_again (e_loop (w), w);
964 UNREF (w); 962 UNREF (w);
963
964NV ev_timer_remaining (ev_timer *w)
965 C_ARGS: e_loop (w), w
965 966
966void DESTROY (ev_timer *w) 967void DESTROY (ev_timer *w)
967 CODE: 968 CODE:
968 STOP (timer, w); 969 STOP (timer, w);
969 e_destroy (w); 970 e_destroy (w);
1290 1291
1291unsigned int ev_backend (struct ev_loop *loop) 1292unsigned int ev_backend (struct ev_loop *loop)
1292 1293
1293unsigned int ev_loop_count (struct ev_loop *loop) 1294unsigned int ev_loop_count (struct ev_loop *loop)
1294 1295
1296unsigned int ev_loop_depth (struct ev_loop *loop)
1297
1295void ev_loop (struct ev_loop *loop, int flags = 0) 1298void ev_loop (struct ev_loop *loop, int flags = 0)
1296 1299
1297void ev_unloop (struct ev_loop *loop, int how = 1) 1300void ev_unloop (struct ev_loop *loop, int how = 1)
1298 1301
1299void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE) 1302void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE)
1300 1303
1304unsigned int ev_pending_count (struct ev_loop *loop)
1305
1306void ev_invoke_pending (struct ev_loop *loop)
1307
1301#if 0 1308#if 0
1302 1309
1303void ev_feed_signal_event (struct ev_loop *loop, SV *signal) 1310void ev_feed_signal_event (struct ev_loop *loop, SV *signal)
1304 CODE: 1311 CODE:
1305{ 1312{
1306 Signal signum = sv_signum (signal); 1313 Signal signum = s_signum (signal);
1307 CHECK_SIG (signal, signum); 1314 CHECK_SIG (signal, signum);
1308 1315
1309 ev_feed_signal_event (loop, signum); 1316 ev_feed_signal_event (loop, signum);
1310} 1317}
1311 1318
1314ev_io *io (struct ev_loop *loop, SV *fh, int events, SV *cb) 1321ev_io *io (struct ev_loop *loop, SV *fh, int events, SV *cb)
1315 ALIAS: 1322 ALIAS:
1316 io_ns = 1 1323 io_ns = 1
1317 CODE: 1324 CODE:
1318{ 1325{
1319 int fd = sv_fileno (fh); 1326 int fd = s_fileno (fh, events & EV_WRITE);
1320 CHECK_FD (fh, fd); 1327 CHECK_FD (fh, fd);
1321 1328
1322 RETVAL = e_new (sizeof (ev_io), cb, ST (0)); 1329 RETVAL = e_new (sizeof (ev_io), cb, ST (0));
1323 RETVAL->fh = newSVsv (fh); 1330 RETVAL->fh = newSVsv (fh);
1324 ev_io_set (RETVAL, fd, events); 1331 ev_io_set (RETVAL, fd, events);
1354 if (!ix) START (periodic, w); 1361 if (!ix) START (periodic, w);
1355} 1362}
1356 OUTPUT: 1363 OUTPUT:
1357 RETVAL 1364 RETVAL
1358 1365
1359#if 0
1360
1361ev_signal *signal (struct ev_loop *loop, SV *signal, SV *cb) 1366ev_signal *signal (struct ev_loop *loop, SV *signal, SV *cb)
1362 ALIAS: 1367 ALIAS:
1363 signal_ns = 1 1368 signal_ns = 1
1364 CODE: 1369 CODE:
1365{ 1370{
1366 Signal signum = sv_signum (signal); 1371 Signal signum = s_signum (signal);
1367 CHECK_SIG (signal, signum); 1372 CHECK_SIG (signal, signum);
1368 1373
1369 RETVAL = e_new (sizeof (ev_signal), cb, ST (0)); 1374 RETVAL = e_new (sizeof (ev_signal), cb, ST (0));
1370 ev_signal_set (RETVAL, signum); 1375 ev_signal_set (RETVAL, signum);
1371 if (!ix) START (signal, RETVAL); 1376 if (!ix) START_SIGNAL (RETVAL);
1372} 1377}
1373 OUTPUT: 1378 OUTPUT:
1374 RETVAL 1379 RETVAL
1375
1376#endif
1377 1380
1378ev_idle *idle (struct ev_loop *loop, SV *cb) 1381ev_idle *idle (struct ev_loop *loop, SV *cb)
1379 ALIAS: 1382 ALIAS:
1380 idle_ns = 1 1383 idle_ns = 1
1381 CODE: 1384 CODE:
1464 1467
1465void once (struct ev_loop *loop, SV *fh, int events, SV *timeout, SV *cb) 1468void once (struct ev_loop *loop, SV *fh, int events, SV *timeout, SV *cb)
1466 CODE: 1469 CODE:
1467 ev_once ( 1470 ev_once (
1468 loop, 1471 loop,
1469 sv_fileno (fh), events, 1472 s_fileno (fh, events & EV_WRITE), events,
1470 SvOK (timeout) ? SvNV (timeout) : -1., 1473 SvOK (timeout) ? SvNV (timeout) : -1.,
1471 e_once_cb, 1474 e_once_cb,
1472 newSVsv (cb) 1475 newSVsv (cb)
1473 ); 1476 );
1474 1477

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines