diff --git a/test/shared/worklet-ipc-large-write.c b/test/shared/worklet-ipc-large-write.c index 803ba00..57b11ec 100644 --- a/test/shared/worklet-ipc-large-write.c +++ b/test/shared/worklet-ipc-large-write.c @@ -103,14 +103,16 @@ main() { err = uv_run(loop, UV_RUN_DEFAULT); assert(err == 0); + // Before the loop closes: the worklet's exit makes this end readable, and the + // poll's callback posts to this loop. + bare_ipc_poll_destroy(&poll); + err = uv_loop_close(loop); assert(err == 0); err = bare_worklet_terminate(&worklet); assert(err == 0); - bare_ipc_poll_destroy(&poll); - bare_ipc_destroy(&ipc); bare_worklet_destroy(&worklet); diff --git a/test/shared/worklet-ipc.c b/test/shared/worklet-ipc.c index 667508d..26b0e1c 100644 --- a/test/shared/worklet-ipc.c +++ b/test/shared/worklet-ipc.c @@ -138,14 +138,16 @@ main() { assert(err == 0); } + // Before the loop closes: the worklet's exit makes this end readable, and the + // poll's callback posts to this loop. + bare_ipc_poll_destroy(&poll); + err = uv_loop_close(loop); assert(err == 0); err = bare_worklet_terminate(&worklet); assert(err == 0); - bare_ipc_poll_destroy(&poll); - bare_ipc_destroy(&ipc); bare_worklet_destroy(&worklet);