summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-08 19:22:35 +0100
committerAnna Henningsen <anna@addaleax.net>2019-02-11 19:57:14 +0100
commit58ba8bfc46c06bf9f75887c18df563d91a1f782c (patch)
tree30e85762e7807e4c6e1c821d1fbf69fc33409ec9 /src/env.h
parente11388b245d9822fcaf2209baaa9e1958d102d2d (diff)
downloadandroid-node-v8-58ba8bfc46c06bf9f75887c18df563d91a1f782c.tar.gz
android-node-v8-58ba8bfc46c06bf9f75887c18df563d91a1f782c.tar.bz2
android-node-v8-58ba8bfc46c06bf9f75887c18df563d91a1f782c.zip
worker: pre-allocate thread id
Allocate a thread id before actually creating the Environment instance. PR-URL: https://github.com/nodejs/node/pull/26011 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/env.h b/src/env.h
index 52d0535721..0228b2d9d0 100644
--- a/src/env.h
+++ b/src/env.h
@@ -618,7 +618,8 @@ class Environment {
Environment(IsolateData* isolate_data,
v8::Local<v8::Context> context,
- Flags flags = Flags());
+ Flags flags = Flags(),
+ uint64_t thread_id = kNoThreadId);
~Environment();
void Start(bool start_profiler_idle_notifier);
@@ -763,6 +764,9 @@ class Environment {
inline bool has_run_bootstrapping_code() const;
inline void set_has_run_bootstrapping_code(bool has_run_bootstrapping_code);
+ static uint64_t AllocateThreadId();
+ static constexpr uint64_t kNoThreadId = -1;
+
inline bool is_main_thread() const;
inline bool owns_process_state() const;
inline bool owns_inspector() const;