Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: Make a loop iteration if polling is interrupted by a signal
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Dec 30, 2012
1 parent 546387f commit 37ec473
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
10 changes: 1 addition & 9 deletions src/unix/kqueue.c
Expand Up @@ -150,14 +150,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (errno != EINTR)
abort();

if (timeout == 0)
return;

if (timeout == -1)
continue;

/* Interrupted by a signal. Update timeout and poll again. */
goto update_timeout;
return;
}

nevents = 0;
Expand Down Expand Up @@ -241,7 +234,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (timeout == -1)
continue;

update_timeout:
assert(timeout > 0);

diff = uv_hrtime() / 1000000;
Expand Down
10 changes: 1 addition & 9 deletions src/unix/linux/linux-core.c
Expand Up @@ -191,14 +191,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (errno != EINTR)
abort();

if (timeout == -1)
continue;

if (timeout == 0)
return;

/* Interrupted by a signal. Update timeout and poll again. */
goto update_timeout;
return;
}

nevents = 0;
Expand Down Expand Up @@ -240,7 +233,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (timeout == -1)
continue;

update_timeout:
assert(timeout > 0);

diff = uv_hrtime() / 1000000;
Expand Down
12 changes: 2 additions & 10 deletions src/unix/sunos.c
Expand Up @@ -150,15 +150,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
abort();
}

if (events[0].portev_source == 0) {
if (timeout == 0)
return;

if (timeout == -1)
continue;

goto update_timeout;
}
if (events[0].portev_source == 0)
return;

if (nfds == 0) {
assert(timeout != -1);
Expand Down Expand Up @@ -208,7 +201,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (timeout == -1)
continue;

update_timeout:
assert(timeout > 0);

diff = uv_hrtime() / 1000000;
Expand Down

0 comments on commit 37ec473

Please sign in to comment.