loop_close: timout after 2 seconds #11821

never UV_RUN_DEFAULT
ref #11820
ref #7376
This commit is contained in:
Justin M. Keyes 2020-02-16 23:54:24 -08:00
parent 2645669c89
commit 284b398eb9

View File

@ -127,8 +127,8 @@ bool loop_close(Loop *loop, bool wait)
uv_close((uv_handle_t *)&loop->async, NULL);
uint64_t start = wait ? os_hrtime() : 0;
while (true) {
uv_run(&loop->uv, wait ? UV_RUN_DEFAULT : UV_RUN_NOWAIT);
if (!uv_loop_close(&loop->uv) || !wait) {
uv_run(&loop->uv, UV_RUN_NOWAIT);
if (!wait || (uv_loop_close(&loop->uv) != UV_EBUSY)) {
break;
}
if (os_hrtime() - start >= 2 * 1000000000) {