Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 11 years ago
parent
commit
4c95af045e
4 changed files with 30 additions and 11 deletions
  1. +1
    -0
      Changes
  2. +9
    -4
      ev.c
  3. +18
    -6
      ev.h
  4. +2
    -1
      ev.pod

+ 1
- 0
Changes View File

@ -13,6 +13,7 @@ TODO: remain
slightly higher accuracy.
- properly declare ev_loop_verify even when !EV_MULTIPLICITY.
- implement ev_loop_depth.
- do not compile in any priority code when EV_MAXPRI == EV_MINPRI.
3.6 Tue Apr 28 02:49:30 CEST 2009
- multiple timers becoming ready within an event loop iteration


+ 9
- 4
ev.c View File

@ -393,8 +393,13 @@ int eventfd (unsigned int initval, int flags);
# define inline_speed static inline
#endif
#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
#define ABSPRI(w) (((W)w)->priority - EV_MINPRI)
#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
#if EV_MINPRI == EV_MAXPRI
# define ABSPRI(w) (((W)w), 0)
#else
# define ABSPRI(w) (((W)w)->priority - EV_MINPRI)
#endif
#define EMPTY /* required for microsofts broken pseudo-c compiler */
#define EMPTY2(a,b) /* used to suppress some warnings */
@ -2260,10 +2265,10 @@ ev_clear_pending (EV_P_ void *w)
inline_size void
pri_adjust (EV_P_ W w)
{
int pri = w->priority;
int pri = ev_priority (w);
pri = pri < EV_MINPRI ? EV_MINPRI : pri;
pri = pri > EV_MAXPRI ? EV_MAXPRI : pri;
w->priority = pri;
ev_set_priority (w, pri);
}
inline_speed void


+ 18
- 6
ev.h View File

@ -189,11 +189,17 @@ struct ev_loop;
* or the array index + 1 in the pendings array.
*/
#if EV_MINPRI == EV_MAXPRI
# define EV_DECL_PRIORITY
#else
# define EV_DECL_PRIORITY int priority;
#endif
/* shared by all watchers */
#define EV_WATCHER(type) \
int active; /* private */ \
int pending; /* private */ \
int priority; /* private */ \
EV_DECL_PRIORITY /* private */ \
EV_COMMON /* rw */ \
EV_CB_DECLARE (type) /* private */
@ -548,9 +554,9 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
/* these may evaluate ev multiple times, and the other arguments at most once */
/* either use ev_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */
#define ev_init(ev,cb_) do { \
((ev_watcher *)(void *)(ev))->active = \
((ev_watcher *)(void *)(ev))->pending = \
((ev_watcher *)(void *)(ev))->priority = 0; \
((ev_watcher *)(void *)(ev))->active = \
((ev_watcher *)(void *)(ev))->pending = 0; \
ev_set_priority ((ev), 0); \
ev_set_cb ((ev), cb_); \
} while (0)
@ -583,9 +589,15 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
#define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
#define ev_priority(ev) ((((ev_watcher *)(void *)(ev))->priority) + 0)
#define ev_cb(ev) (ev)->cb /* rw */
#define ev_set_priority(ev,pri) ((ev_watcher *)(void *)(ev))->priority = (pri)
#if EV_MINPRI == EV_MAXPRI
# define ev_priority(ev) ((ev), EV_MINPRI)
# define ev_set_priority(ev,pri) ((ev), (pri))
#else
# define ev_priority(ev) ((((ev_watcher *)(void *)(ev))->priority) + 0)
# define ev_set_priority(ev,pri) ( (ev_watcher *)(void *)(ev))->priority = (pri)
#endif
#define ev_periodic_at(ev) (((ev_watcher_time *)(ev))->at + 0.)


+ 2
- 1
ev.pod View File

@ -2035,7 +2035,8 @@ Only the default event loop is capable of handling signals, and therefore
you can only register child watchers in the default event loop.
Due to some design glitches inside libev, child watchers will always be
handled at maximum priority (their priority is set to EV_MAXPRI by libev)
handled at maximum priority (their priority is set to C<EV_MAXPRI> by
libev)
=head3 Process Interaction


Loading…
Cancel
Save