Skip to content

Commit 609ae33

Browse files
Lars-Magnus Skogtargos
Lars-Magnus Skog
authored andcommitted
n-api: remove idle_running from TsFn
The idle_running member variable in TsFn is always false and can therefore be removed. PR-URL: #22520 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
1 parent 05d432c commit 609ae33

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
@@ -3717,7 +3717,6 @@ class TsFn: public node::AsyncResource {
37173717
env(env_),
37183718
finalize_data(finalize_data_),
37193719
finalize_cb(finalize_cb_),
3720-
idle_running(false),
37213720
call_js_cb(call_js_cb_ == nullptr ? CallJs : call_js_cb_),
37223721
handles_closing(false) {
37233722
ref.Reset(env->isolate, func);
@@ -3879,8 +3878,6 @@ class TsFn: public node::AsyncResource {
38793878
} else {
38803879
if (uv_idle_stop(&idle) != 0) {
38813880
idle_stop_failed = true;
3882-
} else {
3883-
idle_running = false;
38843881
}
38853882
}
38863883
}
@@ -3913,14 +3910,12 @@ class TsFn: public node::AsyncResource {
39133910
}
39143911

39153912
void MaybeStartIdle() {
3916-
if (!idle_running) {
3917-
if (uv_idle_start(&idle, IdleCb) != 0) {
3918-
v8::HandleScope scope(env->isolate);
3919-
CallbackScope cb_scope(this);
3920-
CHECK(napi_throw_error(env,
3921-
"ERR_NAPI_TSFN_START_IDLE_LOOP",
3922-
"Failed to start the idle loop") == napi_ok);
3923-
}
3913+
if (uv_idle_start(&idle, IdleCb) != 0) {
3914+
v8::HandleScope scope(env->isolate);
3915+
CallbackScope cb_scope(this);
3916+
CHECK(napi_throw_error(env,
3917+
"ERR_NAPI_TSFN_START_IDLE_LOOP",
3918+
"Failed to start the idle loop") == napi_ok);
39243919
}
39253920
}
39263921

@@ -4023,7 +4018,6 @@ class TsFn: public node::AsyncResource {
40234018
napi_env env;
40244019
void* finalize_data;
40254020
napi_finalize finalize_cb;
4026-
bool idle_running;
40274021
napi_threadsafe_function_call_js call_js_cb;
40284022
bool handles_closing;
40294023
};

0 commit comments

Comments
 (0)