diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-02-27 22:02:12 -0800 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-03-21 10:58:19 +0100 |
commit | a8cf886de723437cecbf220ad4e32eef301fde71 (patch) | |
tree | 10f6dd52c05ad70be0392dd2d31db5601eb105a3 /src/node_platform.cc | |
parent | 0e576740dc9ef10203884fd631cef4456b0f3a7c (diff) | |
download | node-new-a8cf886de723437cecbf220ad4e32eef301fde71.tar.gz |
src: shutdown platform from FreePlatform()
There is currently no way to properly do this.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src/node_platform.cc')
-rw-r--r-- | src/node_platform.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node_platform.cc b/src/node_platform.cc index e7c8eadf8f..1b6129596a 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -338,6 +338,10 @@ NodePlatform::NodePlatform(int thread_pool_size, std::make_shared<WorkerThreadsTaskRunner>(thread_pool_size); } +NodePlatform::~NodePlatform() { + Shutdown(); +} + void NodePlatform::RegisterIsolate(Isolate* isolate, uv_loop_t* loop) { Mutex::ScopedLock lock(per_isolate_mutex_); auto delegate = std::make_shared<PerIsolatePlatformData>(isolate, loop); @@ -381,6 +385,8 @@ void NodePlatform::AddIsolateFinishedCallback(Isolate* isolate, } void NodePlatform::Shutdown() { + if (has_shut_down_) return; + has_shut_down_ = true; worker_thread_task_runner_->Shutdown(); { |