File tree 5 files changed +9
-8
lines changed
5 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -712,8 +712,7 @@ ThreadId AllocateEnvironmentThreadId() {
712
712
}
713
713
714
714
void DefaultProcessExitHandler (Environment* env, int exit_code) {
715
- env->set_can_call_into_js (false );
716
- env->stop_sub_worker_contexts ();
715
+ Stop (env);
717
716
DisposePlatform ();
718
717
exit (exit_code);
719
718
}
Original file line number Diff line number Diff line change @@ -523,9 +523,10 @@ void Environment::InitializeLibuv(bool start_profiler_idle_notifier) {
523
523
}
524
524
}
525
525
526
- void Environment::ExitEnv () {
526
+ void Environment::Stop () {
527
527
set_can_call_into_js (false );
528
528
set_stopping (true );
529
+ stop_sub_worker_contexts ();
529
530
isolate_->TerminateExecution ();
530
531
SetImmediateThreadsafe ([](Environment* env) { uv_stop (env->event_loop ()); });
531
532
}
Original file line number Diff line number Diff line change @@ -913,7 +913,7 @@ class Environment : public MemoryRetainer {
913
913
void RegisterHandleCleanups ();
914
914
void CleanupHandles ();
915
915
void Exit (int code);
916
- void ExitEnv ();
916
+ void Stop ();
917
917
918
918
// Register clean-up cb to be called on environment destruction.
919
919
inline void RegisterHandleCleanup (uv_handle_t * handle,
Original file line number Diff line number Diff line change @@ -1035,7 +1035,7 @@ int Start(int argc, char** argv) {
1035
1035
}
1036
1036
1037
1037
int Stop (Environment* env) {
1038
- env->ExitEnv ();
1038
+ env->Stop ();
1039
1039
return 0 ;
1040
1040
}
1041
1041
Original file line number Diff line number Diff line change @@ -218,7 +218,8 @@ class Environment;
218
218
NODE_EXTERN int Start (int argc, char * argv[]);
219
219
220
220
// Tear down Node.js while it is running (there are active handles
221
- // in the loop and / or actively executing JavaScript code).
221
+ // in the loop and / or actively executing JavaScript code). This also stops
222
+ // all Workers that may have been started earlier.
222
223
NODE_EXTERN int Stop (Environment* env);
223
224
224
225
// TODO(addaleax): Officially deprecate this and replace it with something
@@ -457,8 +458,8 @@ NODE_EXTERN void FreeEnvironment(Environment* env);
457
458
// It receives the Environment* instance and the exit code as arguments.
458
459
// This could e.g. call Stop(env); in order to terminate execution and stop
459
460
// the event loop.
460
- // The default handler disposes of the global V8 platform instance, if one is
461
- // being used, and calls exit().
461
+ // The default handler calls Stop(), disposes of the global V8 platform
462
+ // instance, if one is being used, and calls exit().
462
463
NODE_EXTERN void SetProcessExitHandler (
463
464
Environment* env,
464
465
std::function<void (Environment*, int )>&& handler);
You can’t perform that action at this time.
0 commit comments