summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorroot <root>2009-01-06 19:46:56 +0000
committerroot <root>2009-01-06 19:46:56 +0000
commitff4968a12811c47cdda59e91c9c5b1d4355800ab (patch)
tree3f76d5a6956009ed7488a50060450c7103a4061d /ev.c
parent3a75abe4102c7f57b275b3a0febe1ebc6d05bd62 (diff)
*** empty log message ***
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/ev.c b/ev.c
index 5433353..0d8ca4e 100644
--- a/ev.c
+++ b/ev.c
@@ -1,7 +1,7 @@
/*
* libev event processing core, watcher management
*
- * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
@@ -750,7 +750,7 @@ fd_reify (EV_P)
#else
anfd->handle = _get_osfhandle (fd);
#endif
- assert (("libev only supports socket fds in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
+ assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
}
#endif
@@ -1133,7 +1133,7 @@ ev_feed_signal_event (EV_P_ int signum)
WL w;
#if EV_MULTIPLICITY
- assert (("feeding signal events is only supported in the default loop", loop == ev_default_loop_ptr));
+ assert (("libev: feeding signal events is only supported in the default loop", loop == ev_default_loop_ptr));
#endif
--signum;
@@ -1272,8 +1272,9 @@ ev_recommended_backends (void)
flags &= ~EVBACKEND_KQUEUE;
#endif
#ifdef __APPLE__
- // flags &= ~EVBACKEND_KQUEUE & ~EVBACKEND_POLL; for documentation
- flags &= ~EVBACKEND_SELECT;
+ /* only select works correctly on that "unix-certified" platform */
+ flags &= ~EVBACKEND_KQUEUE; /* horribly broken, even for sockets */
+ flags &= ~EVBACKEND_POLL; /* poll is based on kqueue from 10.5 onwards */
#endif
return flags;
@@ -1536,10 +1537,10 @@ ev_loop_fork (EV_P)
static void noinline
verify_watcher (EV_P_ W w)
{
- assert (("watcher has invalid priority", ABSPRI (w) >= 0 && ABSPRI (w) < NUMPRI));
+ assert (("libev: watcher has invalid priority", ABSPRI (w) >= 0 && ABSPRI (w) < NUMPRI));
if (w->pending)
- assert (("pending watcher not on pending queue", pendings [ABSPRI (w)][w->pending - 1].w == w));
+ assert (("libev: pending watcher not on pending queue", pendings [ABSPRI (w)][w->pending - 1].w == w));
}
static void noinline
@@ -1549,9 +1550,9 @@ verify_heap (EV_P_ ANHE *heap, int N)
for (i = HEAP0; i < N + HEAP0; ++i)
{
- assert (("active index mismatch in heap", ev_active (ANHE_w (heap [i])) == i));
- assert (("heap condition violated", i == HEAP0 || ANHE_at (heap [HPARENT (i)]) <= ANHE_at (heap [i])));
- assert (("heap at cache mismatch", ANHE_at (heap [i]) == ev_at (ANHE_w (heap [i]))));
+ assert (("libev: active index mismatch in heap", ev_active (ANHE_w (heap [i])) == i));
+ assert (("libev: heap condition violated", i == HEAP0 || ANHE_at (heap [HPARENT (i)]) <= ANHE_at (heap [i])));
+ assert (("libev: heap at cache mismatch", ANHE_at (heap [i]) == ev_at (ANHE_w (heap [i]))));
verify_watcher (EV_A_ (W)ANHE_w (heap [i]));
}
@@ -1562,7 +1563,7 @@ array_verify (EV_P_ W *ws, int cnt)
{
while (cnt--)
{
- assert (("active index mismatch", ev_active (ws [cnt]) == cnt + 1));
+ assert (("libev: active index mismatch", ev_active (ws [cnt]) == cnt + 1));
verify_watcher (EV_A_ ws [cnt]);
}
}
@@ -1579,15 +1580,15 @@ ev_loop_verify (EV_P)
assert (fdchangemax >= fdchangecnt);
for (i = 0; i < fdchangecnt; ++i)
- assert (("negative fd in fdchanges", fdchanges [i] >= 0));
+ assert (("libev: negative fd in fdchanges", fdchanges [i] >= 0));
assert (anfdmax >= 0);
for (i = 0; i < anfdmax; ++i)
for (w = anfds [i].head; w; w = w->next)
{
verify_watcher (EV_A_ (W)w);
- assert (("inactive fd watcher on anfd list", ev_active (w) == 1));
- assert (("fd mismatch between watcher and anfd", ((ev_io *)w)->fd == i));
+ assert (("libev: inactive fd watcher on anfd list", ev_active (w) == 1));
+ assert (("libev: fd mismatch between watcher and anfd", ((ev_io *)w)->fd == i));
}
assert (timermax >= timercnt);
@@ -1714,7 +1715,7 @@ call_pending (EV_P)
if (expect_true (p->w))
{
- /*assert (("non-pending watcher on pending list", p->w->pending));*/
+ /*assert (("libev: non-pending watcher on pending list", p->w->pending));*/
p->w->pending = 0;
EV_CB_INVOKE (p->w, p->events);
@@ -1755,7 +1756,7 @@ timers_reify (EV_P)
{
ev_timer *w = (ev_timer *)ANHE_w (timers [HEAP0]);
- /*assert (("inactive timer on timer heap detected", ev_is_active (w)));*/
+ /*assert (("libev: inactive timer on timer heap detected", ev_is_active (w)));*/
/* first reschedule or stop timer */
if (w->repeat)
@@ -1764,7 +1765,7 @@ timers_reify (EV_P)
if (ev_at (w) < mn_now)
ev_at (w) = mn_now;
- assert (("negative ev_timer repeat value found while processing timers", w->repeat > 0.));
+ assert (("libev: negative ev_timer repeat value found while processing timers", w->repeat > 0.));
ANHE_at_cache (timers [HEAP0]);
downheap (timers, timercnt, HEAP0);
@@ -1787,14 +1788,14 @@ periodics_reify (EV_P)
{
ev_periodic *w = (ev_periodic *)ANHE_w (periodics [HEAP0]);
- /*assert (("inactive timer on periodic heap detected", ev_is_active (w)));*/
+ /*assert (("libev: inactive timer on periodic heap detected", ev_is_active (w)));*/
/* first reschedule or stop timer */
if (w->reschedule_cb)
{
ev_at (w) = w->reschedule_cb (w, ev_rt_now);
- assert (("ev_periodic reschedule callback returned time in the past", ev_at (w) >= ev_rt_now));
+ assert (("libev: ev_periodic reschedule callback returned time in the past", ev_at (w) >= ev_rt_now));
ANHE_at_cache (periodics [HEAP0]);
downheap (periodics, periodiccnt, HEAP0);
@@ -2155,8 +2156,8 @@ ev_io_start (EV_P_ ev_io *w)
if (expect_false (ev_is_active (w)))
return;
- assert (("ev_io_start called with negative fd", fd >= 0));
- assert (("ev_io start called with illegal event mask", !(w->events & ~(EV_IOFDSET | EV_READ | EV_WRITE))));
+ assert (("libev: ev_io_start called with negative fd", fd >= 0));
+ assert (("libev: ev_io start called with illegal event mask", !(w->events & ~(EV_IOFDSET | EV_READ | EV_WRITE))));
EV_FREQUENT_CHECK;
@@ -2177,7 +2178,7 @@ ev_io_stop (EV_P_ ev_io *w)
if (expect_false (!ev_is_active (w)))
return;
- assert (("ev_io_stop called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax));
+ assert (("libev: ev_io_stop called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax));
EV_FREQUENT_CHECK;
@@ -2197,7 +2198,7 @@ ev_timer_start (EV_P_ ev_timer *w)
ev_at (w) += mn_now;
- assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.));
+ assert (("libev: ev_timer_start called with negative timer repeat value", w->repeat >= 0.));
EV_FREQUENT_CHECK;
@@ -2210,7 +2211,7 @@ ev_timer_start (EV_P_ ev_timer *w)
EV_FREQUENT_CHECK;
- /*assert (("internal timer heap corruption", timers [ev_active (w)] == (WT)w));*/
+ /*assert (("libev: internal timer heap corruption", timers [ev_active (w)] == (WT)w));*/
}
void noinline
@@ -2225,7 +2226,7 @@ ev_timer_stop (EV_P_ ev_timer *w)
{
int active = ev_active (w);
- assert (("internal timer heap corruption", ANHE_w (timers [active]) == (WT)w));
+ assert (("libev: internal timer heap corruption", ANHE_w (timers [active]) == (WT)w));
--timercnt;
@@ -2279,7 +2280,7 @@ ev_periodic_start (EV_P_ ev_periodic *w)
ev_at (w) = w->reschedule_cb (w, ev_rt_now);
else if (w->interval)
{
- assert (("ev_periodic_start called with negative interval value", w->interval >= 0.));
+ assert (("libev: ev_periodic_start called with negative interval value", w->interval >= 0.));
/* this formula differs from the one in periodic_reify because we do not always round up */
ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
}
@@ -2297,7 +2298,7 @@ ev_periodic_start (EV_P_ ev_periodic *w)
EV_FREQUENT_CHECK;
- /*assert (("internal periodic heap corruption", ANHE_w (periodics [ev_active (w)]) == (WT)w));*/
+ /*assert (("libev: internal periodic heap corruption", ANHE_w (periodics [ev_active (w)]) == (WT)w));*/
}
void noinline
@@ -2312,7 +2313,7 @@ ev_periodic_stop (EV_P_ ev_periodic *w)
{
int active = ev_active (w);
- assert (("internal periodic heap corruption", ANHE_w (periodics [active]) == (WT)w));
+ assert (("libev: internal periodic heap corruption", ANHE_w (periodics [active]) == (WT)w));
--periodiccnt;
@@ -2345,12 +2346,12 @@ void noinline
ev_signal_start (EV_P_ ev_signal *w)
{
#if EV_MULTIPLICITY
- assert (("signal watchers are only supported in the default loop", loop == ev_default_loop_ptr));
+ assert (("libev: signal watchers are only supported in the default loop", loop == ev_default_loop_ptr));
#endif
if (expect_false (ev_is_active (w)))
return;
- assert (("ev_signal_start called with illegal signal number", w->signum > 0));
+ assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0));
evpipe_init (EV_A);
@@ -2411,7 +2412,7 @@ void
ev_child_start (EV_P_ ev_child *w)
{
#if EV_MULTIPLICITY
- assert (("child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
+ assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
#endif
if (expect_false (ev_is_active (w)))
return;
@@ -2935,7 +2936,7 @@ ev_embed_start (EV_P_ ev_embed *w)
{
struct ev_loop *loop = w->other;
- assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
+ assert (("libev: loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
ev_io_init (&w->io, embed_io_cb, backend_fd, EV_READ);
}