worker: correct (de)initialization order
- Initialize
thread_exit_async_
only once the thread has been started. This is done since it is only triggered from the thread when it is exiting. - Move the final
uv_run
to theWorker
destructor. This makes sure that it is always run, regardless of whether the thread is actually started or not. - Always dispose the
Isolate
before cleaning up the libuv event loop. This now matches the reverse order of initialization.
Fixes: https://github.com/nodejs/node/issues/22736
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
/cc @nodejs/workers