Browse Source

verify backend fudge factors by reading kernel sources

master
Marc Alexander Lehmann 9 years ago
parent
commit
123c7142b3
5 changed files with 13 additions and 6 deletions
  1. +3
    -0
      Changes
  2. +1
    -1
      ev_epoll.c
  3. +1
    -1
      ev_kqueue.c
  4. +1
    -1
      ev_poll.c
  5. +7
    -3
      ev_select.c

+ 3
- 0
Changes View File

@ -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.


+ 1
- 1
ev_epoll.c View File

@ -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;


+ 1
- 1
ev_kqueue.c View File

@ -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;


+ 1
- 1
ev_poll.c View File

@ -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;


+ 7
- 3
ev_select.c View File

@ -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
}

Loading…
Cancel
Save