Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-10 22:47:03 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-21 12:57:08 +0300
commitd7bc5816a5d88e18d7ede081042d87f48a2bc54b (patch)
treef8b5c540eb6a127aeac87b3c0f37e99655ed8f2f /src/node_platform.cc
parent78a2dc7de2139cc51cf4992da7d835eed0b69c32 (diff)
src: make `FreeEnvironment()` perform all necessary cleanup
Make the calls `stop_sub_worker_contexts()`, `RunCleanup()` part of the public API for easier embedding. (Note that calling `RunAtExit()` is idempotent because the at-exit callback queue is cleared after each call.) 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.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/node_platform.cc b/src/node_platform.cc
index 740ace1fb78..7628cf5339c 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -421,6 +421,7 @@ void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) {
void NodePlatform::DrainTasks(Isolate* isolate) {
std::shared_ptr<PerIsolatePlatformData> per_isolate = ForNodeIsolate(isolate);
+ if (!per_isolate) return;
do {
// Worker tasks aren't associated with an Isolate.
@@ -489,12 +490,14 @@ std::shared_ptr<PerIsolatePlatformData>
NodePlatform::ForNodeIsolate(Isolate* isolate) {
Mutex::ScopedLock lock(per_isolate_mutex_);
auto data = per_isolate_[isolate];
- CHECK(data.second);
+ CHECK_NOT_NULL(data.first);
return data.second;
}
bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
- return ForNodeIsolate(isolate)->FlushForegroundTasksInternal();
+ std::shared_ptr<PerIsolatePlatformData> per_isolate = ForNodeIsolate(isolate);
+ if (!per_isolate) return false;
+ return per_isolate->FlushForegroundTasksInternal();
}
bool NodePlatform::IdleTasksEnabled(Isolate* isolate) {