summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes3
-rw-r--r--ev_epoll.c2
-rw-r--r--ev_kqueue.c2
-rw-r--r--ev_poll.c2
-rw-r--r--ev_select.c10
5 files changed, 13 insertions, 6 deletions
diff --git a/Changes b/Changes
index 8732867..9f72f8c 100644
--- a/Changes
+++ b/Changes
@@ -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.
diff --git a/ev_epoll.c b/ev_epoll.c
index 5deb652..1b8a3e9 100644
--- a/ev_epoll.c
+++ b/ev_epoll.c
@@ -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;
diff --git a/ev_poll.c b/ev_poll.c
index e53ae0d..7c7ece1 100644
--- a/ev_poll.c
+++ b/ev_poll.c
@@ -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
}
-