Skip to content

Commit 776a1d0

Browse files
trevnorrisliujinye-sys
authored andcommitted
zos: fix potential event loop stall
This is a port of 70002c8 to z/OS to fix the same potential issue that could effectively enter an infinite loop (but not a busy loop) under certain conditions when polling for events. PR-URL: libuv/libuv#2725 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Jameson Nash <vtjnash@gmail.com>
1 parent 628d5e8 commit 776a1d0

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/unix/os390.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
887887
if (nfds == 0) {
888888
assert(timeout != -1);
889889

890-
if (timeout > 0) {
891-
timeout = real_timeout - timeout;
892-
continue;
893-
}
890+
if (timeout == 0)
891+
return;
894892

895-
return;
893+
/* We may have been inside the system call for longer than |timeout|
894+
* milliseconds so we need to update the timestamp to avoid drift.
895+
*/
896+
goto update_timeout;
896897
}
897898

898899
if (nfds == -1) {

0 commit comments

Comments
 (0)