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 committed by GitHub
parent b353a5c05f
commit a2efc9cf8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

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) {