GeezerVison is showing github.com — Revert "embedding: make Stop() stop Workers" · cheza24/node@f621536
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/api/environment.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -725,7 +725,8 @@ ThreadId AllocateEnvironmentThreadId() { |
725 | 725 | } |
726 | 726 |
|
727 | 727 | void DefaultProcessExitHandler(Environment* env, int exit_code) { |
728 | | - Stop(env); |
| 728 | + env->set_can_call_into_js(false); |
| 729 | + env->stop_sub_worker_contexts(); |
729 | 730 | DisposePlatform(); |
730 | 731 | exit(exit_code); |
731 | 732 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: src/env.cc +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -528,10 +528,9 @@ void Environment::InitializeLibuv(bool start_profiler_idle_notifier) { |
528 | 528 | } |
529 | 529 | } |
530 | 530 |
|
531 | | -void Environment::Stop() { |
| 531 | +void Environment::ExitEnv() { |
532 | 532 | set_can_call_into_js(false); |
533 | 533 | set_stopping(true); |
534 | | - stop_sub_worker_contexts(); |
535 | 534 | isolate_->TerminateExecution(); |
536 | 535 | SetImmediateThreadsafe([](Environment* env) { uv_stop(env->event_loop()); }); |
537 | 536 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: src/env.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -899,7 +899,7 @@ class Environment : public MemoryRetainer { |
899 | 899 | void RegisterHandleCleanups(); |
900 | 900 | void CleanupHandles(); |
901 | 901 | void Exit(int code); |
902 | | - void Stop(); |
| 902 | + void ExitEnv(); |
903 | 903 |
|
904 | 904 | // Register clean-up cb to be called on environment destruction. |
905 | 905 | inline void RegisterHandleCleanup(uv_handle_t* handle, |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1059,7 +1059,7 @@ int Start(int argc, char** argv) { |
1059 | 1059 | } |
1060 | 1060 |
|
1061 | 1061 | int Stop(Environment* env) { |
1062 | | - env->Stop(); |
| 1062 | + env->ExitEnv(); |
1063 | 1063 | return 0; |
1064 | 1064 | } |
1065 | 1065 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: src/node.h +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -224,8 +224,7 @@ class Environment; |
224 | 224 | NODE_EXTERN int Start(int argc, char* argv[]); |
225 | 225 |
|
226 | 226 | // Tear down Node.js while it is running (there are active handles |
227 | | -// in the loop and / or actively executing JavaScript code). This also stops |
228 | | -// all Workers that may have been started earlier. |
| 227 | +// in the loop and / or actively executing JavaScript code). |
229 | 228 | NODE_EXTERN int Stop(Environment* env); |
230 | 229 |
|
231 | 230 | // TODO(addaleax): Officially deprecate this and replace it with something |
@@ -479,8 +478,8 @@ NODE_EXTERN void FreeEnvironment(Environment* env); |
479 | 478 | // It receives the Environment* instance and the exit code as arguments. |
480 | 479 | // This could e.g. call Stop(env); in order to terminate execution and stop |
481 | 480 | // the event loop. |
482 | | -// The default handler calls Stop(), disposes of the global V8 platform |
483 | | -// instance, if one is being used, and calls exit(). |
| 481 | +// The default handler disposes of the global V8 platform instance, if one is |
| 482 | +// being used, and calls exit(). |
484 | 483 | NODE_EXTERN void SetProcessExitHandler( |
485 | 484 | Environment* env, |
486 | 485 | std::function<void(Environment*, int)>&& handler); |
|