diff --git a/src/node_platform.cc b/src/node_platform.cc index 6c09cd1440e9cf..4815e8acd99c2f 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -101,6 +101,7 @@ class WorkerThreadsTaskRunner::DelayedTaskScheduler { std::unique_ptr Start() { auto start_thread = [](void* data) { + uv_thread_setname("DelayedTaskSchedulerWorker"); static_cast(data)->Run(); }; std::unique_ptr t { new uv_thread_t() }; diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index 3ea43177a4d75e..f9bfa0e0c86f94 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -80,6 +80,7 @@ Watchdog::~Watchdog() { void Watchdog::Run(void* arg) { + uv_thread_setname("Watchdog"); Watchdog* wd = static_cast(arg); // UV_RUN_DEFAULT the loop will be stopped either by the async or the @@ -229,9 +230,9 @@ void TraceSigintWatchdog::HandleInterrupt() { #ifdef __POSIX__ void* SigintWatchdogHelper::RunSigintWatchdog(void* arg) { + uv_thread_setname("SigintWatchdog"); // Inside the helper thread. bool is_stopping; - do { uv_sem_wait(&instance.sem_); is_stopping = InformWatchdogsAboutSignal(); diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc index 7ce59674356f97..eddcf6c3bf91b7 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -94,10 +94,15 @@ void Agent::Start() { // This thread should be created *after* async handles are created // (within NodeTraceWriter and NodeTraceBuffer constructors). // Otherwise the thread could shut down prematurely. - CHECK_EQ(0, uv_thread_create(&thread_, [](void* arg) { - Agent* agent = static_cast(arg); - uv_run(&agent->tracing_loop_, UV_RUN_DEFAULT); - }, this)); + CHECK_EQ(0, + uv_thread_create( + &thread_, + [](void* arg) { + uv_thread_setname("TraceEventWorker"); + Agent* agent = static_cast(arg); + uv_run(&agent->tracing_loop_, UV_RUN_DEFAULT); + }, + this)); started_ = true; }