GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: remove loop_init_failed_ from Worker class · nodejs/node@4df3ac2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_worker.cc
    • node_worker.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_worker.cc‎

Copy file name to clipboardExpand all lines: src/node_worker.cc
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ class WorkerThreadData {
140140
uv_err_name_r(ret, err_buf, sizeof(err_buf));
141141
w->custom_error_ = "ERR_WORKER_INIT_FAILED";
142142
w->custom_error_str_ = err_buf;
143-
w->loop_init_failed_ = true;
144143
w->stopped_ = true;
145144
return;
146145
}
146+
loop_init_failed_ = false;
147147

148148
std::shared_ptr<ArrayBufferAllocator> allocator =
149149
ArrayBufferAllocator::Create();
@@ -199,6 +199,7 @@ class WorkerThreadData {
199199
}
200200

201201
if (isolate != nullptr) {
202+
CHECK(!loop_init_failed_);
202203
bool platform_finished = false;
203204

204205
isolate_data_.reset();
@@ -217,18 +218,20 @@ class WorkerThreadData {
217218

218219
// Wait until the platform has cleaned up all relevant resources.
219220
while (!platform_finished) {
220-
CHECK(!w_->loop_init_failed_);
221221
uv_run(&loop_, UV_RUN_ONCE);
222222
}
223223
}
224-
if (!w_->loop_init_failed_) {
224+
if (!loop_init_failed_) {
225225
CheckedUvLoopClose(&loop_);
226226
}
227227
}
228228

229+
bool loop_is_usable() const { return !loop_init_failed_; }
230+
229231
private:
230232
Worker* const w_;
231233
uv_loop_t loop_;
234+
bool loop_init_failed_ = true;
232235
DeleteFnPtr<IsolateData, FreeIsolateData> isolate_data_;
233236

234237
friend class Worker;
@@ -258,7 +261,7 @@ void Worker::Run() {
258261

259262
WorkerThreadData data(this);
260263
if (isolate_ == nullptr) return;
261-
CHECK(!data.w_->loop_init_failed_);
264+
CHECK(data.loop_is_usable());
262265

263266
Debug(this, "Starting worker with id %llu", thread_id_);
264267
{
Collapse file

‎src/node_worker.h‎

Copy file name to clipboardExpand all lines: src/node_worker.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class Worker : public AsyncWrap {
8686
bool thread_joined_ = true;
8787
const char* custom_error_ = nullptr;
8888
std::string custom_error_str_;
89-
bool loop_init_failed_ = false;
9089
int exit_code_ = 0;
9190
uint64_t thread_id_ = -1;
9291
uintptr_t stack_base_ = 0;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.