Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-api: remove idle_running from TsFn #22520

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/node_api.cc
Expand Up @@ -3717,7 +3717,6 @@ class TsFn: public node::AsyncResource {
env(env_),
finalize_data(finalize_data_),
finalize_cb(finalize_cb_),
idle_running(false),
call_js_cb(call_js_cb_ == nullptr ? CallJs : call_js_cb_),
handles_closing(false) {
ref.Reset(env->isolate, func);
Expand Down Expand Up @@ -3879,8 +3878,6 @@ class TsFn: public node::AsyncResource {
} else {
if (uv_idle_stop(&idle) != 0) {
idle_stop_failed = true;
} else {
idle_running = false;
}
}
}
Expand Down Expand Up @@ -3913,14 +3910,12 @@ class TsFn: public node::AsyncResource {
}

void MaybeStartIdle() {
if (!idle_running) {
if (uv_idle_start(&idle, IdleCb) != 0) {
v8::HandleScope scope(env->isolate);
CallbackScope cb_scope(this);
CHECK(napi_throw_error(env,
"ERR_NAPI_TSFN_START_IDLE_LOOP",
"Failed to start the idle loop") == napi_ok);
}
if (uv_idle_start(&idle, IdleCb) != 0) {
v8::HandleScope scope(env->isolate);
CallbackScope cb_scope(this);
CHECK(napi_throw_error(env,
"ERR_NAPI_TSFN_START_IDLE_LOOP",
"Failed to start the idle loop") == napi_ok);
}
}

Expand Down Expand Up @@ -4023,7 +4018,6 @@ class TsFn: public node::AsyncResource {
napi_env env;
void* finalize_data;
napi_finalize finalize_cb;
bool idle_running;
napi_threadsafe_function_call_js call_js_cb;
bool handles_closing;
};
Expand Down