mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
@@ -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();
|
||||
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
public:
|
||||
NodePlatform(int thread_pool_size,
|
||||
v8::TracingController* tracing_controller);
|
||||
~NodePlatform() override = default;
|
||||
~NodePlatform() override;
|
||||
|
||||
void DrainTasks(v8::Isolate* isolate) override;
|
||||
void Shutdown();
|
||||
@@ -180,6 +180,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
|
||||
v8::TracingController* tracing_controller_;
|
||||
std::shared_ptr<WorkerThreadsTaskRunner> worker_thread_task_runner_;
|
||||
bool has_shut_down_ = false;
|
||||
};
|
||||
|
||||
} // namespace node
|
||||
|
||||
Reference in New Issue
Block a user