--- /dev/null
+Revision history for libev, a high-performance and full-featured event loop
+
+0.1 Wed Oct 31 21:31:48 CET 2007
+ - original version; hacked together in <24h.
+
/* called on EBADF to verify fds */
static void
-fd_recheck ()
+fd_recheck (void)
{
int fd;
if (anfds [fd].wev)
if (fcntl (fd, F_GETFD) == -1 && errno == EBADF)
while (anfds [fd].head)
- evio_stop (anfds [fd].head);
+ {
+ event ((W)anfds [fd].head, EV_ERROR);
+ evio_stop (anfds [fd].head);
+ }
}
/*****************************************************************************/
# include "ev_select.c"
#endif
+int
+ev_version_major (void)
+{
+ return EV_VERSION_MAJOR;
+}
+
+int
+ev_version_minor (void)
+{
+ return EV_VERSION_MINOR;
+}
+
int ev_init (int flags)
{
if (!ev_method)
/*****************************************************************************/
-void ev_prefork (void)
+void
+ev_prefork (void)
{
/* nop */
}
-void ev_postfork_parent (void)
+void
+ev_postfork_parent (void)
{
/* nop */
}
-void ev_postfork_child (void)
+void
+ev_postfork_child (void)
{
#if HAVE_EPOLL
if (ev_method == EVMETHOD_EPOLL)
}
static void
-call_pending ()
+call_pending (void)
{
while (pendingcnt)
{
}
static void
-timers_reify ()
+timers_reify (void)
{
while (timercnt && timers [0]->at <= now)
{
}
static void
-periodics_reify ()
+periodics_reify (void)
{
while (periodiccnt && periodics [0]->at <= ev_now)
{
}
static void
-time_update ()
+time_update (void)
{
int i;
/* eventmask, revents, events... */
#define EV_UNDEF -1 /* guaranteed to be invalid */
-#define EV_NONE 0x00
-#define EV_READ 0x01
-#define EV_WRITE 0x02
-#define EV_TIMEOUT 0x04
-#define EV_SIGNAL 0x08
-#define EV_IDLE 0x10
-#define EV_CHECK 0x20
-#define EV_PREPARE 0x40
-#define EV_CHILD 0x80
-#define EV_ERROR (0xff|0x8000)
+#define EV_NONE 0x000000
+#define EV_READ 0x000001
+#define EV_WRITE 0x000002
+#define EV_TIMEOUT 0x000004
+#define EV_SIGNAL 0x000008
+#define EV_IDLE 0x000010
+#define EV_CHECK 0x000020
+#define EV_PREPARE 0x000040
+#define EV_CHILD 0x000080
+#define EV_ERROR 0x800000
/* can be used to add custom fields to all watchers */
#ifndef EV_COMMON
# define EV_PROTOTYPES 1
#endif
+#define EV_VERSION_MAJOR 1
+#define EV_VERSION_MINOR 1
+
/*
* struct member types:
* private: you can look at them, but not change them, and they might not mean anything to you.
#if EV_PROTOTYPES
extern int ev_method;
int ev_init (int flags); /* returns ev_method */
+int ev_version_major (void);
+int ev_version_minor (void);
/* these three calls are suitable for plugging into pthread_atfork */
void ev_prefork (void);
epoll_ctl (epoll_fd, mode, fd, &ev);
}
-void epoll_postfork_child (void)
+static void
+epoll_postfork_child (void)
{
int fd;
static struct epoll_event *events;
static int eventmax;
-static void epoll_poll (ev_tstamp timeout)
+static void
+epoll_poll (ev_tstamp timeout)
{
int eventcnt = epoll_wait (epoll_fd, events, eventmax, ceil (timeout * 1000.));
int i;
}
}
-void epoll_init (int flags)
+static void
+epoll_init (int flags)
{
epoll_fd = epoll_create (256);
eventmax = 64; /* intiial number of events receivable per poll */
events = malloc (sizeof (struct epoll_event) * eventmax);
}
+
vec_wi [offs] &= ~mask;
}
-static void select_poll (ev_tstamp timeout)
+static void
+select_poll (ev_tstamp timeout)
{
struct timeval tv;
int res;
}
}
-void select_init (int flags)
+static void
+select_init (int flags)
{
ev_method = EVMETHOD_SELECT;
method_fudge = 1e-2; /* needed to compensate for select returning early, very conservative */
method_poll = select_poll;
}
-