1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

At least wait 1ms when <1ms, to avoid epoll_wait spin loop. 4.0.66

This commit is contained in:
winlin 2021-02-04 16:51:47 +08:00
parent 19a7c7682e
commit cfddc8f266
3 changed files with 7 additions and 1 deletions

View file

@ -1210,6 +1210,11 @@ ST_HIDDEN void _st_epoll_dispatch(void)
} else {
min_timeout = (_ST_SLEEPQ->due <= _ST_LAST_CLOCK) ? 0 : (_ST_SLEEPQ->due - _ST_LAST_CLOCK);
timeout = (int) (min_timeout / 1000);
// At least wait 1ms when <1ms, to avoid epoll_wait spin loop.
if (min_timeout > 0 && timeout == 0) {
timeout = 1;
}
}
if (_st_epoll_data->pid != getpid()) {