Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-06-16 02:14:46 +0300
committerMichaƫl Zasso <targos@protonmail.com>2018-06-16 11:37:38 +0300
commit529d24e3e88fa6a0091c56ee41a4a89113c142ba (patch)
tree28c28e22c95500e2ac4653bea1ea7c2b97b2e1d7 /src
parente00e5e6d5dcf6689bcc38c74fe04c40e2d02a7d1 (diff)
Revert "workers,trace_events: set thread name for workers"
This reverts commit a24b691c6cfb31bc77f5d0cd64596106dc21d890. PR-URL: https://github.com/nodejs/node/pull/21363 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/env-inl.h4
-rw-r--r--src/env.h6
-rw-r--r--src/node_worker.cc15
-rw-r--r--src/node_worker.h2
4 files changed, 9 insertions, 18 deletions
diff --git a/src/env-inl.h b/src/env-inl.h
index bbb80c6f7ae..c84fdf0bb82 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -598,11 +598,11 @@ inline bool Environment::is_main_thread() const {
return thread_id_ == 0;
}
-inline uint64_t Environment::thread_id() const {
+inline double Environment::thread_id() const {
return thread_id_;
}
-inline void Environment::set_thread_id(uint64_t id) {
+inline void Environment::set_thread_id(double id) {
thread_id_ = id;
}
diff --git a/src/env.h b/src/env.h
index 786f0846f4a..1a96abe106a 100644
--- a/src/env.h
+++ b/src/env.h
@@ -726,8 +726,8 @@ class Environment {
bool is_stopping_worker() const;
inline bool is_main_thread() const;
- inline uint64_t thread_id() const;
- inline void set_thread_id(uint64_t id);
+ inline double thread_id() const;
+ inline void set_thread_id(double id);
inline worker::Worker* worker_context() const;
inline void set_worker_context(worker::Worker* context);
inline void add_sub_worker_context(worker::Worker* context);
@@ -881,7 +881,7 @@ class Environment {
std::unordered_map<std::string, uint64_t> performance_marks_;
bool can_call_into_js_ = true;
- uint64_t thread_id_ = 0;
+ double thread_id_ = 0;
std::unordered_set<worker::Worker*> sub_worker_contexts_;
diff --git a/src/node_worker.cc b/src/node_worker.cc
index c628e6295c4..320b6703d40 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -9,8 +9,6 @@
#include "async_wrap.h"
#include "async_wrap-inl.h"
-#include <string>
-
using v8::ArrayBuffer;
using v8::Context;
using v8::Function;
@@ -32,7 +30,7 @@ namespace worker {
namespace {
-uint64_t next_thread_id = 1;
+double next_thread_id = 1;
Mutex next_thread_id_mutex;
} // anonymous namespace
@@ -46,8 +44,7 @@ Worker::Worker(Environment* env, Local<Object> wrap)
}
wrap->Set(env->context(),
env->thread_id_string(),
- Number::New(env->isolate(),
- static_cast<double>(thread_id_))).FromJust();
+ Number::New(env->isolate(), thread_id_)).FromJust();
// Set up everything that needs to be set up in the parent environment.
parent_port_ = MessagePort::New(env, env->context());
@@ -115,11 +112,6 @@ bool Worker::is_stopped() const {
}
void Worker::Run() {
- std::string name = "WorkerThread ";
- name += std::to_string(thread_id_);
- TRACE_EVENT_METADATA1(
- "__metadata", "thread_name", "name",
- TRACE_STR_COPY(name.c_str()));
MultiIsolatePlatform* platform = isolate_data_->platform();
CHECK_NE(platform, nullptr);
@@ -426,8 +418,7 @@ void InitWorker(Local<Object> target,
auto thread_id_string = FIXED_ONE_BYTE_STRING(env->isolate(), "threadId");
target->Set(env->context(),
thread_id_string,
- Number::New(env->isolate(),
- static_cast<double>(env->thread_id()))).FromJust();
+ Number::New(env->isolate(), env->thread_id())).FromJust();
}
} // anonymous namespace
diff --git a/src/node_worker.h b/src/node_worker.h
index d802b5cfefd..0a98d2f11ef 100644
--- a/src/node_worker.h
+++ b/src/node_worker.h
@@ -62,7 +62,7 @@ class Worker : public AsyncWrap {
bool thread_joined_ = true;
int exit_code_ = 0;
- uint64_t thread_id_ = -1;
+ double thread_id_ = -1;
std::unique_ptr<MessagePortData> child_port_data_;