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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines