diff --git a/src/unix/signal.c b/src/unix/signal.c index ad3b57f..00089a8 100644 --- a/src/unix/signal.c +++ b/src/unix/signal.c @@ -470,9 +470,9 @@ static void uv__get_process_name(char* processName, int bufferLength) { } } - -static void uv__set_signal_flag(uv__loop_internal_fields_t* lfields) { +static int uv__set_signal_flag() { static int trigger = -1; + if (trigger == -1) { char processName[1024] = {0}; uv__get_process_name(processName, sizeof(processName)); @@ -483,7 +483,7 @@ static void uv__set_signal_flag(uv__loop_internal_fields_t* lfields) { trigger = 1; } } - lfields->trigger = (unsigned int)trigger; + return trigger; } #endif @@ -500,7 +500,7 @@ static void uv__signal_event(uv_loop_t* loop, bytes = 0; end = 0; #ifdef USE_FFRT - uv__set_signal_flag(loop->internal_fields); + unsigned int trigger = uv__set_signal_flag(); #endif do { r = read(loop->signal_pipefd[0], buf + bytes, sizeof(buf) - bytes); @@ -542,8 +542,7 @@ static void uv__signal_event(uv_loop_t* loop, if (msg->signum == handle->signum) { assert(!(handle->flags & UV_HANDLE_CLOSING)); #ifdef USE_FFRT - uv__loop_internal_fields_t* lfields = uv__get_internal_fields(handle->loop); - if (lfields->trigger != 1) { + if (trigger != 1) { handle->signal_cb(handle, handle->signum); } #else diff --git a/src/uv-common.h b/src/uv-common.h index bfb0400..7ca246f 100644 --- a/src/uv-common.h +++ b/src/uv-common.h @@ -449,7 +449,6 @@ struct uv__loop_internal_fields_s { #endif /* __linux__ */ #ifdef USE_FFRT struct uv__queue wq_sub[5]; - unsigned int trigger; #endif };