mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
when converting usec to msec round up; so that libevent does not spin until
the time conversion has caught up; from Aaron Hopkins <aaron at die.net> svn:r121
This commit is contained in:
parent
fa6c304d9e
commit
96a25ae6a2
@ -177,7 +177,7 @@ devpoll_dispatch(void *arg, struct timeval *tv)
|
||||
if (evsignal_deliver(&devpollop->evsigmask) == -1)
|
||||
return (-1);
|
||||
|
||||
timeout = tv->tv_sec * 1000 + tv->tv_usec / 1000;
|
||||
timeout = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000;
|
||||
|
||||
dvp.dp_fds = devpollop->events;
|
||||
dvp.dp_nfds = devpollop->nevents;
|
||||
|
2
epoll.c
2
epoll.c
@ -189,7 +189,7 @@ epoll_dispatch(void *arg, struct timeval *tv)
|
||||
if (evsignal_deliver(&epollop->evsigmask) == -1)
|
||||
return (-1);
|
||||
|
||||
timeout = tv->tv_sec * 1000 + tv->tv_usec / 1000;
|
||||
timeout = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000;
|
||||
res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout);
|
||||
|
||||
if (evsignal_recalc(&epollop->evsigmask) == -1)
|
||||
|
2
poll.c
2
poll.c
@ -166,7 +166,7 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
if (evsignal_deliver(&pop->evsigmask) == -1)
|
||||
return (-1);
|
||||
|
||||
sec = tv->tv_sec * 1000 + tv->tv_usec / 1000;
|
||||
sec = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000;
|
||||
res = poll(pop->event_set, nfds, sec);
|
||||
|
||||
if (evsignal_recalc(&pop->evsigmask) == -1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user