mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +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)
|
if (evsignal_deliver(&devpollop->evsigmask) == -1)
|
||||||
return (-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_fds = devpollop->events;
|
||||||
dvp.dp_nfds = devpollop->nevents;
|
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)
|
if (evsignal_deliver(&epollop->evsigmask) == -1)
|
||||||
return (-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);
|
res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout);
|
||||||
|
|
||||||
if (evsignal_recalc(&epollop->evsigmask) == -1)
|
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)
|
if (evsignal_deliver(&pop->evsigmask) == -1)
|
||||||
return (-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);
|
res = poll(pop->event_set, nfds, sec);
|
||||||
|
|
||||||
if (evsignal_recalc(&pop->evsigmask) == -1)
|
if (evsignal_recalc(&pop->evsigmask) == -1)
|
||||||
|
3
rtsig.c
3
rtsig.c
@ -368,7 +368,8 @@ rtsig_dispatch(void *arg, struct timeval *tv)
|
|||||||
if (!op->cur)
|
if (!op->cur)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
res = poll(op->poll, op->cur, tv->tv_sec * 1000 + tv->tv_usec / 1000);
|
res = poll(op->poll, op->cur, tv->tv_sec * 1000 +
|
||||||
|
(tv->tv_usec + 999) / 1000);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user