Skip to content

Commit 0c3137f

Browse files
author
Andrew
authored
Fix hang in syncio_close (#763)
1 parent 265df19 commit 0c3137f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/win32/win32compat/termio.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ syncio_close(struct w32_io* pio)
293293
CancelSynchronousIo(pio->read_overlapped.hEvent);
294294
}
295295

296-
WaitForSingleObject(pio->read_overlapped.hEvent, INFINITE);
296+
// give the read thread some time to wind down, but don't block syncio_close
297+
if (WAIT_TIMEOUT == WaitForSingleObject(pio->read_overlapped.hEvent, 1000)) {
298+
debug4("read_overlapped thread timed out");
299+
}
297300
}
298301

299302
/* drain queued APCs */

0 commit comments

Comments
 (0)