mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
src: remove loop_init_failed_ from Worker class
There’s no reason for this to not be stored alongside the loop data structure itself. PR-URL: https://github.com/nodejs/node/pull/32562 Refs: https://github.com/nodejs/node/pull/32344 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
9f6ed724e0
commit
464ff85ddd
2 files changed
+7
-5
No files matched your search
+7
-4
@@ -145,10 +145,10 @@ class WorkerThreadData {
|
||||
uv_err_name_r(ret, err_buf, sizeof(err_buf));
|
||||
w->custom_error_ = "ERR_WORKER_INIT_FAILED";
|
||||
w->custom_error_str_ = err_buf;
|
||||
w->loop_init_failed_ = true;
|
||||
w->stopped_ = true;
|
||||
return;
|
||||
}
|
||||
loop_init_failed_ = false;
|
||||
|
||||
Isolate::CreateParams params;
|
||||
SetIsolateCreateParamsForNode(¶ms);
|
||||
@@ -201,6 +201,7 @@ class WorkerThreadData {
|
||||
}
|
||||
|
||||
if (isolate != nullptr) {
|
||||
CHECK(!loop_init_failed_);
|
||||
bool platform_finished = false;
|
||||
|
||||
isolate_data_.reset();
|
||||
@@ -219,18 +220,20 @@ class WorkerThreadData {
|
||||
|
||||
// Wait until the platform has cleaned up all relevant resources.
|
||||
while (!platform_finished) {
|
||||
CHECK(!w_->loop_init_failed_);
|
||||
uv_run(&loop_, UV_RUN_ONCE);
|
||||
}
|
||||
}
|
||||
if (!w_->loop_init_failed_) {
|
||||
if (!loop_init_failed_) {
|
||||
CheckedUvLoopClose(&loop_);
|
||||
}
|
||||
}
|
||||
|
||||
bool loop_is_usable() const { return !loop_init_failed_; }
|
||||
|
||||
private:
|
||||
Worker* const w_;
|
||||
uv_loop_t loop_;
|
||||
bool loop_init_failed_ = true;
|
||||
DeleteFnPtr<IsolateData, FreeIsolateData> isolate_data_;
|
||||
|
||||
friend class Worker;
|
||||
@@ -260,7 +263,7 @@ void Worker::Run() {
|
||||
|
||||
WorkerThreadData data(this);
|
||||
if (isolate_ == nullptr) return;
|
||||
CHECK(!data.w_->loop_init_failed_);
|
||||
CHECK(data.loop_is_usable());
|
||||
|
||||
Debug(this, "Starting worker with id %llu", thread_id_);
|
||||
{
|
||||
|
||||
@@ -88,7 +88,6 @@ class Worker : public AsyncWrap {
|
||||
bool thread_joined_ = true;
|
||||
const char* custom_error_ = nullptr;
|
||||
std::string custom_error_str_;
|
||||
bool loop_init_failed_ = false;
|
||||
int exit_code_ = 0;
|
||||
uint64_t thread_id_ = -1;
|
||||
uintptr_t stack_base_ = 0;
|
||||
|
||||
Reference in new issue
Block a user