Skip to content

Commit 09b88aa

Browse files
Lars-Magnus Skogrvagg
Lars-Magnus Skog
authored andcommittedFeb 28, 2019
n-api: remove idle_running from TsFn
The idle_running member variable in TsFn is always false and can therefore be removed. Backport-PR-URL: #25002 PR-URL: #22520 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Gus Caplan <me@gus.host>
1 parent 67b6e0d commit 09b88aa

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed
 

‎src/node_api.cc

+6-12
Original file line numberDiff line numberDiff line change
@@ -3614,7 +3614,6 @@ class TsFn: public node::AsyncResource {
36143614
env(env_),
36153615
finalize_data(finalize_data_),
36163616
finalize_cb(finalize_cb_),
3617-
idle_running(false),
36183617
call_js_cb(call_js_cb_ == nullptr ? CallJs : call_js_cb_),
36193618
handles_closing(false) {
36203619
ref.Reset(env->isolate, func);
@@ -3779,8 +3778,6 @@ class TsFn: public node::AsyncResource {
37793778
} else {
37803779
if (uv_idle_stop(&idle) != 0) {
37813780
idle_stop_failed = true;
3782-
} else {
3783-
idle_running = false;
37843781
}
37853782
}
37863783
}
@@ -3813,14 +3810,12 @@ class TsFn: public node::AsyncResource {
38133810
}
38143811

38153812
void MaybeStartIdle() {
3816-
if (!idle_running) {
3817-
if (uv_idle_start(&idle, IdleCb) != 0) {
3818-
v8::HandleScope scope(env->isolate);
3819-
CallbackScope cb_scope(this);
3820-
CHECK(napi_throw_error(env,
3821-
"ERR_NAPI_TSFN_START_IDLE_LOOP",
3822-
"Failed to start the idle loop") == napi_ok);
3823-
}
3813+
if (uv_idle_start(&idle, IdleCb) != 0) {
3814+
v8::HandleScope scope(env->isolate);
3815+
CallbackScope cb_scope(this);
3816+
CHECK(napi_throw_error(env,
3817+
"ERR_NAPI_TSFN_START_IDLE_LOOP",
3818+
"Failed to start the idle loop") == napi_ok);
38243819
}
38253820
}
38263821

@@ -3923,7 +3918,6 @@ class TsFn: public node::AsyncResource {
39233918
napi_env env;
39243919
void* finalize_data;
39253920
napi_finalize finalize_cb;
3926-
bool idle_running;
39273921
napi_threadsafe_function_call_js call_js_cb;
39283922
bool handles_closing;
39293923
};

0 commit comments

Comments
 (0)
Please sign in to comment.