/*
+ * libev event processing core, watcher management
+ *
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
#include <time.h>
#ifndef EV_USE_MONOTONIC
-# ifdef CLOCK_MONOTONIC
-# define EV_USE_MONOTONIC 1
-# endif
+# define EV_USE_MONOTONIC 1
+#endif
+
+#ifndef CLOCK_MONOTONIC
+# undef EV_USE_MONOTONIC
+# define EV_USE_MONOTONIC 0
#endif
#ifndef EV_USE_SELECT
sigcb (struct ev_io *iow, int revents)
{
struct ev_signal *w;
- int sig;
+ int signum;
read (sigpipe [0], &revents, 1);
gotsig = 0;
- for (sig = signalmax; sig--; )
- if (signals [sig].gotsig)
+ for (signum = signalmax; signum--; )
+ if (signals [signum].gotsig)
{
- signals [sig].gotsig = 0;
+ signals [signum].gotsig = 0;
- for (w = signals [sig].head; w; w = w->next)
+ for (w = signals [signum].head; w; w = w->next)
event ((W)w, EV_SIGNAL);
}
}
while ((pid = waitpid (-1, &status, WNOHANG | WUNTRACED | WCONTINUED)) != -1)
for (w = childs [pid & (PID_HASHSIZE - 1)]; w; w = w->next)
- if (w->pid == pid || w->pid == -1)
+ if (w->pid == pid || !w->pid)
{
w->status = status;
event ((W)w, EV_CHILD);
void
ev_io_start (struct ev_io *w)
{
+ int fd = w->fd;
+
if (ev_is_active (w))
return;
- int fd = w->fd;
-
assert (("ev_io_start called with negative fd", fd >= 0));
ev_start ((W)w, 1);