… | |
… | |
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 | #define EV_STANDALONE 1 |
18 | #define EV_PROTOTYPES 1 |
19 | #define EV_PROTOTYPES 1 |
19 | #define EV_USE_NANOSLEEP EV_USE_MONOTONIC |
20 | #define EV_USE_NANOSLEEP EV_USE_MONOTONIC |
20 | #define EV_H <ev.h> |
21 | #define EV_H <ev.h> |
|
|
22 | #define EV_CONFIG_H error |
21 | #include "EV/EVAPI.h" |
23 | #include "EV/EVAPI.h" |
22 | |
24 | |
23 | #define EV_SELECT_IS_WINSOCKET 0 |
25 | #define EV_SELECT_IS_WINSOCKET 0 |
24 | #ifdef _WIN32 |
26 | #ifdef _WIN32 |
25 | # define EV_SELECT_USE_FD_SET 0 |
27 | # define EV_SELECT_USE_FD_SET 0 |
… | |
… | |
358 | const_iv (EV_, UNDEF) |
360 | const_iv (EV_, UNDEF) |
359 | const_iv (EV_, NONE) |
361 | const_iv (EV_, NONE) |
360 | const_iv (EV_, READ) |
362 | const_iv (EV_, READ) |
361 | const_iv (EV_, WRITE) |
363 | const_iv (EV_, WRITE) |
362 | const_iv (EV_, IO) |
364 | const_iv (EV_, IO) |
363 | const_iv (EV_, TIMEOUT) |
365 | const_iv (EV_, TIMEOUT) /* deprecated */ |
364 | const_iv (EV_, TIMER) |
366 | const_iv (EV_, TIMER) |
365 | const_iv (EV_, PERIODIC) |
367 | const_iv (EV_, PERIODIC) |
366 | const_iv (EV_, SIGNAL) |
368 | const_iv (EV_, SIGNAL) |
367 | const_iv (EV_, CHILD) |
369 | const_iv (EV_, CHILD) |
368 | const_iv (EV_, STAT) |
370 | const_iv (EV_, STAT) |
… | |
… | |
386 | const_iv (EV, BACKEND_POLL) |
388 | const_iv (EV, BACKEND_POLL) |
387 | const_iv (EV, BACKEND_EPOLL) |
389 | const_iv (EV, BACKEND_EPOLL) |
388 | const_iv (EV, BACKEND_KQUEUE) |
390 | const_iv (EV, BACKEND_KQUEUE) |
389 | const_iv (EV, BACKEND_DEVPOLL) |
391 | const_iv (EV, BACKEND_DEVPOLL) |
390 | const_iv (EV, BACKEND_PORT) |
392 | const_iv (EV, BACKEND_PORT) |
|
|
393 | const_iv (EV, BACKEND_ALL) |
391 | const_iv (EV, FLAG_AUTO) |
394 | const_iv (EV, FLAG_AUTO) |
|
|
395 | const_iv (EV, FLAG_FORKCHECK) |
|
|
396 | const_iv (EV, FLAG_SIGNALFD) |
392 | const_iv (EV, FLAG_NOENV) |
397 | const_iv (EV, FLAG_NOENV) |
|
|
398 | const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */ |
393 | const_iv (EV, FLAG_FORKCHECK) |
399 | const_iv (EV, FLAG_NOINOTIFY) |
394 | |
400 | |
395 | const_iv (EV_, VERSION_MAJOR) |
401 | const_iv (EV_, VERSION_MAJOR) |
396 | const_iv (EV_, VERSION_MINOR) |
402 | const_iv (EV_, VERSION_MINOR) |
397 | }; |
403 | }; |
398 | |
404 | |
… | |
… | |
578 | C_ARGS: evapi.default_loop |
584 | C_ARGS: evapi.default_loop |
579 | |
585 | |
580 | ev_io *io (SV *fh, int events, SV *cb) |
586 | ev_io *io (SV *fh, int events, SV *cb) |
581 | ALIAS: |
587 | ALIAS: |
582 | io_ns = 1 |
588 | io_ns = 1 |
|
|
589 | _ae_io = 2 |
583 | CODE: |
590 | CODE: |
584 | { |
591 | { |
585 | int fd = s_fileno (fh, events & EV_WRITE); |
592 | int fd = s_fileno (fh, events & EV_WRITE); |
586 | 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 | } |
587 | |
600 | |
588 | RETVAL = e_new (sizeof (ev_io), cb, default_loop_sv); |
601 | RETVAL = e_new (sizeof (ev_io), cb, default_loop_sv); |
589 | RETVAL->fh = newSVsv (fh); |
602 | RETVAL->fh = newSVsv (fh); |
590 | ev_io_set (RETVAL, fd, events); |
603 | ev_io_set (RETVAL, fd, events); |
591 | if (!ix) START (io, RETVAL); |
604 | if (!ix) START (io, RETVAL); |