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

Comparing EV/EV.xs (file contents):
Revision 1.175 by root, Sun Jul 7 05:46:01 2019 UTC vs.
Revision 1.179 by root, Wed Jan 22 22:24:53 2020 UTC

42# define fd_mask Perl_fd_mask 42# define fd_mask Perl_fd_mask
43#endif 43#endif
44/* due to bugs in OS X we have to use libev/ explicitly here */ 44/* due to bugs in OS X we have to use libev/ explicitly here */
45#include "libev/ev.c" 45#include "libev/ev.c"
46 46
47#if !defined _WIN32 && !defined _MINIX && !EV_NO_ATFORK 47#if !defined _WIN32 && !defined __minix && !EV_NO_ATFORK
48# include <pthread.h> 48# include <pthread.h>
49#endif 49#endif
50 50
51#define e_loop(w) INT2PTR (struct ev_loop *, SvIVX (((ev_watcher *)(w))->loop)) 51#define e_loop(w) INT2PTR (struct ev_loop *, SvIVX (((ev_watcher *)(w))->loop))
52#define e_flags(w) ((ev_watcher *)(w))->e_flags 52#define e_flags(w) ((ev_watcher *)(w))->e_flags
82 do { \ 82 do { \
83 REF (w); \ 83 REF (w); \
84 ev_ ## type ## _stop (e_loop (w), w); \ 84 ev_ ## type ## _stop (e_loop (w), w); \
85 } while (0) 85 } while (0)
86 86
87#define PAUSE(type) \
88 do { \
89 int active = ev_is_active (w); \
90 if (active) STOP (type, w)
91
92#define RESUME(type) \
93 if (active) START (type, w); \
94 } while (0)
95
96
87#define RESET(type,w,seta) \ 97#define RESET(type,w,seta) \
88 do { \ 98 PAUSE (type); \
89 int active = ev_is_active (w); \
90 if (active) STOP (type, w); \
91 ev_ ## type ## _set seta; \ 99 ev_ ## type ## _set seta; \
92 if (active) START (type, w); \ 100 RESUME (type)
93 } while (0)
94 101
95typedef int Signal; 102typedef int Signal;
96 103
97/* horrible... */ 104/* horrible... */
98#define CHECK_SIGNAL_CAN_START(w) \ 105#define CHECK_SIGNAL_CAN_START(w) \
994int events (ev_io *w, int new_events = EV_UNDEF) 1001int events (ev_io *w, int new_events = EV_UNDEF)
995 CODE: 1002 CODE:
996{ 1003{
997 RETVAL = w->events; 1004 RETVAL = w->events;
998 1005
999 if (items > 1) 1006 if (items > 1 && (new_events ^ w->events) & (EV_READ | EV_WRITE))
1000 RESET (io, w, (w, w->fd, new_events)); 1007 {
1008 PAUSE (io);
1009 ev_io_modify (w, new_events);
1010 RESUME (io);
1011 }
1001} 1012}
1002 OUTPUT: 1013 OUTPUT:
1003 RETVAL 1014 RETVAL
1004 1015
1005MODULE = EV PACKAGE = EV::Signal PREFIX = ev_signal_ 1016MODULE = EV PACKAGE = EV::Signal PREFIX = ev_signal_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines