ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.h
(Generate patch)

Comparing libev/ev.h (file contents):
Revision 1.33 by root, Sun Nov 4 23:14:11 2007 UTC vs.
Revision 1.35 by root, Sun Nov 4 23:51:02 2007 UTC

197 int pid; /* ro */ 197 int pid; /* ro */
198 int rpid; /* rw, holds the received pid */ 198 int rpid; /* rw, holds the received pid */
199 int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */ 199 int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */
200}; 200};
201 201
202union ev_any_watcher
203{
204 struct ev_watcher w;
205 struct ev_watcher_list wl;
206 struct ev_io io;
207 struct ev_timer timer;
208 struct ev_periodic periodic;
209 struct ev_signal signal;
210 struct ev_idle idle;
211 struct ev_child child;
212 struct ev_prepare prepare;
213 struct ev_check check;
214};
215
202#define EVMETHOD_AUTO 0 /* consults environment */ 216#define EVMETHOD_AUTO 0 /* consults environment */
203#define EVMETHOD_SELECT 1 217#define EVMETHOD_SELECT 1
204#define EVMETHOD_POLL 2 218#define EVMETHOD_POLL 2
205#define EVMETHOD_EPOLL 4 219#define EVMETHOD_EPOLL 4
206#define EVMETHOD_KQUEUE 8 220#define EVMETHOD_KQUEUE 8
263#endif 277#endif
264 278
265/* these may evaluate ev multiple times, and the other arguments at most once */ 279/* these may evaluate ev multiple times, and the other arguments at most once */
266/* either use ev_watcher_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */ 280/* either use ev_watcher_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */
267#define ev_watcher_init(ev,cb_) do { \ 281#define ev_watcher_init(ev,cb_) do { \
268 ((struct ev_watcher *)(ev))->active = \ 282 ((struct ev_watcher *)(void *)(ev))->active = \
269 ((struct ev_watcher *)(ev))->pending = \ 283 ((struct ev_watcher *)(void *)(ev))->pending = \
270 ((struct ev_watcher *)(ev))->priority = 0; \ 284 ((struct ev_watcher *)(void *)(ev))->priority = 0; \
271 (ev)->cb = (cb_); \ 285 (ev)->cb = (cb_); \
272} while (0) 286} while (0)
273 287
274#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0) 288#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0)
275#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0) 289#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0)
287#define ev_idle_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_idle_set ((ev)); } while (0) 301#define ev_idle_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_idle_set ((ev)); } while (0)
288#define ev_prepare_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0) 302#define ev_prepare_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0)
289#define ev_check_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_check_set ((ev)); } while (0) 303#define ev_check_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_check_set ((ev)); } while (0)
290#define ev_child_init(ev,cb,pid) do { ev_watcher_init ((ev), (cb)); ev_child_set ((ev),(pid)); } while (0) 304#define ev_child_init(ev,cb,pid) do { ev_watcher_init ((ev), (cb)); ev_child_set ((ev),(pid)); } while (0)
291 305
292#define ev_is_pending(ev) (0 + ((struct ev_watcher *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */ 306#define ev_is_pending(ev) (0 + ((struct ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
293#define ev_is_active(ev) (0 + ((struct ev_watcher *)(ev))->active) /* ro, true when the watcher has been started */ 307#define ev_is_active(ev) (0 + ((struct ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
294 308
295#define ev_priority(ev) ((struct ev_watcher *)(ev))->priority /* rw */ 309#define ev_priority(ev) ((struct ev_watcher *)(void *)(ev))->priority /* rw */
296#define ev_cb(ev) (ev)->cb /* rw */ 310#define ev_cb(ev) (ev)->cb /* rw */
297#define ev_set_priority(ev,pri) ev_priority (ev) = (pri) 311#define ev_set_priority(ev,pri) ev_priority (ev) = (pri)
298#define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_) 312#define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
299 313
300/* stopping (enabling, adding) a watcher does nothing if it is already running */ 314/* stopping (enabling, adding) a watcher does nothing if it is already running */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines