@@ -145,10 +145,10 @@ class WorkerThreadData {
145
145
uv_err_name_r (ret, err_buf, sizeof (err_buf));
146
146
w->custom_error_ = " ERR_WORKER_INIT_FAILED" ;
147
147
w->custom_error_str_ = err_buf;
148
- w->loop_init_failed_ = true ;
149
148
w->stopped_ = true ;
150
149
return ;
151
150
}
151
+ loop_init_failed_ = false ;
152
152
153
153
Isolate::CreateParams params;
154
154
SetIsolateCreateParamsForNode (¶ms);
@@ -201,6 +201,7 @@ class WorkerThreadData {
201
201
}
202
202
203
203
if (isolate != nullptr ) {
204
+ CHECK (!loop_init_failed_);
204
205
bool platform_finished = false ;
205
206
206
207
isolate_data_.reset ();
@@ -219,18 +220,20 @@ class WorkerThreadData {
219
220
220
221
// Wait until the platform has cleaned up all relevant resources.
221
222
while (!platform_finished) {
222
- CHECK (!w_->loop_init_failed_ );
223
223
uv_run (&loop_, UV_RUN_ONCE);
224
224
}
225
225
}
226
- if (!w_-> loop_init_failed_ ) {
226
+ if (!loop_init_failed_) {
227
227
CheckedUvLoopClose (&loop_);
228
228
}
229
229
}
230
230
231
+ bool loop_is_usable () const { return !loop_init_failed_; }
232
+
231
233
private:
232
234
Worker* const w_;
233
235
uv_loop_t loop_;
236
+ bool loop_init_failed_ = true ;
234
237
DeleteFnPtr<IsolateData, FreeIsolateData> isolate_data_;
235
238
236
239
friend class Worker ;
@@ -260,7 +263,7 @@ void Worker::Run() {
260
263
261
264
WorkerThreadData data (this );
262
265
if (isolate_ == nullptr ) return ;
263
- CHECK (! data.w_ -> loop_init_failed_ );
266
+ CHECK (data.loop_is_usable () );
264
267
265
268
Debug (this , " Starting worker with id %llu" , thread_id_);
266
269
{
0 commit comments