diff options
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | ev_epoll.c | 2 | ||||
-rw-r--r-- | ev_kqueue.c | 2 | ||||
-rw-r--r-- | ev_poll.c | 2 | ||||
-rw-r--r-- | ev_select.c | 10 |
5 files changed, 13 insertions, 6 deletions
@@ -5,6 +5,9 @@ TODO: ev_loop_wakeup TODO: confusion about threads ongiong TODO: not_blocked flag. + - correct backend_fudge for most backends, and implement a windows + specific workaround to avoid looping because we call both + select and Sleep, both with different time resolutions. - change the default periodic reschedule function to hopefully be more exact and correct even in corner cases or in the far future. - document reasonable ranges for interval and offset. @@ -234,7 +234,7 @@ epoll_init (EV_P_ int flags) fcntl (backend_fd, F_SETFD, FD_CLOEXEC); - backend_fudge = 0.; /* kernel sources seem to indicate this to be zero */ + backend_fudge = 1./1024.; /* epoll does sometimes return early, this is just to avoid the worst */ backend_modify = epoll_modify; backend_poll = epoll_poll; diff --git a/ev_kqueue.c b/ev_kqueue.c index 1b526d1..b70faa1 100644 --- a/ev_kqueue.c +++ b/ev_kqueue.c @@ -161,7 +161,7 @@ kqueue_init (EV_P_ int flags) fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ - backend_fudge = 0.; + backend_fudge = 1e-9; /* apparently, they did the right thing in freebsd */ backend_modify = kqueue_modify; backend_poll = kqueue_poll; @@ -129,7 +129,7 @@ poll_poll (EV_P_ ev_tstamp timeout) int inline_size poll_init (EV_P_ int flags) { - backend_fudge = 0.; /* posix says this is zero */ + backend_fudge = 1e-3; backend_modify = poll_modify; backend_poll = poll_poll; diff --git a/ev_select.c b/ev_select.c index 0ea9467..fdf2adc 100644 --- a/ev_select.c +++ b/ev_select.c @@ -195,7 +195,12 @@ select_poll (EV_P_ ev_tstamp timeout) */ if (errno == EINVAL) { - ev_sleep (timeout); + if (timeout) + { + unsigned long ms = timeout * 1e3; + Sleep (ms ? ms : 1); + } + return; } #endif @@ -269,7 +274,7 @@ select_poll (EV_P_ ev_tstamp timeout) int inline_size select_init (EV_P_ int flags) { - backend_fudge = 0.; /* posix says this is zero */ + backend_fudge = 1e-6; backend_modify = select_modify; backend_poll = select_poll; @@ -307,4 +312,3 @@ select_destroy (EV_P) #endif } - |