summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes4
-rw-r--r--ev.c8
-rw-r--r--ev.pod6
-rw-r--r--ev_epoll.c2
-rw-r--r--ev_poll.c4
-rw-r--r--ev_port.c2
6 files changed, 21 insertions, 5 deletions
diff --git a/Changes b/Changes
index 53bb646..9fa01e5 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for libev, a high-performance and full-featured event loop.
+TODO: signal mask problem documentation
+TODO: ev_loop_wakeup
+ - do no rely on ceil() in ev_e?poll.c.
+
4.03 Tue Jan 11 14:37:25 CET 2011
- officially support polling files with all backends.
- support files, /dev/zero etc. the same way as select in the epoll
diff --git a/ev.c b/ev.c
index 1a8b319..dbac270 100644
--- a/ev.c
+++ b/ev.c
@@ -817,6 +817,14 @@ ev_sleep (ev_tstamp delay)
}
}
+inline_speed int
+ev_timeout_to_ms (ev_tstamp timeout)
+{
+ int ms = timeout * 1000. + .999999;
+
+ return expect_true (ms) ? ms : timeout < 1e-6 ? 0 : 1;
+}
+
/*****************************************************************************/
#define MALLOC_ROUND 4096 /* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */
diff --git a/ev.pod b/ev.pod
index 6cd777e..3c605c1 100644
--- a/ev.pod
+++ b/ev.pod
@@ -444,6 +444,9 @@ This behaviour is useful when you want to do your own signal handling, or
want to handle signals only in specific threads and want to avoid libev
unblocking the signals.
+It's also required by POSIX in a threaded program, as libev calls
+C<sigprocmask>, whose behaviour is officially unspecified.
+
This flag's behaviour will become the default in future versions of libev.
=item C<EVBACKEND_SELECT> (value 1, portable select backend)
@@ -2302,7 +2305,8 @@ and unblock them in an C<ev_prepare> watcher.
Both the signal mask (C<sigprocmask>) and the signal disposition
(C<sigaction>) are unspecified after starting a signal watcher (and after
stopping it again), that is, libev might or might not block the signal,
-and might or might not set or restore the installed signal handler.
+and might or might not set or restore the installed signal handler (but
+see C<EVFLAG_NOSIGMASK>).
While this does not matter for the signal disposition (libev never
sets signals to C<SIG_IGN>, so handlers will be reset to C<SIG_DFL> on
diff --git a/ev_epoll.c b/ev_epoll.c
index d0caa93..2c9dda0 100644
--- a/ev_epoll.c
+++ b/ev_epoll.c
@@ -148,7 +148,7 @@ epoll_poll (EV_P_ ev_tstamp timeout)
/* the default libev max wait time, however. */
EV_RELEASE_CB;
eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax,
- epoll_epermcnt ? 0 : (int)ceil (timeout * 1000.));
+ epoll_epermcnt ? 0 : ev_timeout_to_ms (timeout));
EV_ACQUIRE_CB;
if (expect_false (eventcnt < 0))
diff --git a/ev_poll.c b/ev_poll.c
index 81e4b53..e15504b 100644
--- a/ev_poll.c
+++ b/ev_poll.c
@@ -1,7 +1,7 @@
/*
* libev poll fd activity backend
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
@@ -92,7 +92,7 @@ poll_poll (EV_P_ ev_tstamp timeout)
int res;
EV_RELEASE_CB;
- res = poll (polls, pollcnt, (int)ceil (timeout * 1000.));
+ res = poll (polls, pollcnt, ev_timeout_to_ms (timeout));
EV_ACQUIRE_CB;
if (expect_false (res < 0))
diff --git a/ev_port.c b/ev_port.c
index 9044ef7..a078de5 100644
--- a/ev_port.c
+++ b/ev_port.c
@@ -1,7 +1,7 @@
/*
* libev solaris event port backend
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-