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

Comparing libev/event.c (file contents):
Revision 1.43 by root, Fri Oct 15 22:44:42 2010 UTC vs.
Revision 1.46 by root, Sun Oct 24 17:19:47 2010 UTC

1/* 1/*
2 * libevent compatibility layer 2 * libevent compatibility layer
3 * 3 *
4 * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
45# include EV_EVENT_H 45# include EV_EVENT_H
46#else 46#else
47# include "event.h" 47# include "event.h"
48#endif 48#endif
49 49
50/* same definition as in ev.c */
51#define EV_TV_SET(tv,t) do { tv.tv_sec = (long)t; tv.tv_usec = (long)((t - tv.tv_sec) * 1e6); } while (0)
52
50#if EV_MULTIPLICITY 53#if EV_MULTIPLICITY
51# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base 54# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base
52# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base 55# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base
53#else 56#else
54# define dLOOPev 57# define dLOOPev
138} 141}
139 142
140static void 143static void
141ev_x_cb (struct event *ev, int revents) 144ev_x_cb (struct event *ev, int revents)
142{ 145{
143 revents &= EV_READ | EV_WRITE | EV_TIMEOUT | EV_SIGNAL; 146 revents &= EV_READ | EV_WRITE | EV_TIMER | EV_SIGNAL;
144 147
145 ev->ev_res = revents; 148 ev->ev_res = revents;
146 ev->ev_callback (ev->ev_fd, (short)revents, ev->ev_arg); 149 ev->ev_callback (ev->ev_fd, (short)revents, ev->ev_arg);
147} 150}
148 151
325 328
326int event_base_loop (struct event_base *base, int flags) 329int event_base_loop (struct event_base *base, int flags)
327{ 330{
328 dLOOPbase; 331 dLOOPbase;
329 332
330 ev_loop (EV_A_ flags); 333 ev_run (EV_A_ flags);
331 334
332 return 0; 335 return 0;
333} 336}
334 337
335int event_base_dispatch (struct event_base *base) 338int event_base_dispatch (struct event_base *base)
340static void 343static void
341ev_x_loopexit_cb (int revents, void *base) 344ev_x_loopexit_cb (int revents, void *base)
342{ 345{
343 dLOOPbase; 346 dLOOPbase;
344 347
345 ev_unloop (EV_A_ EVUNLOOP_ONE); 348 ev_break (EV_A_ EVBREAK_ONE);
346} 349}
347 350
348int event_base_loopexit (struct event_base *base, struct timeval *tv) 351int event_base_loopexit (struct event_base *base, struct timeval *tv)
349{ 352{
350 ev_tstamp after = ev_tv_get (tv); 353 ev_tstamp after = ev_tv_get (tv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines