Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! worker: pre-allocate thread id
  • Loading branch information
addaleax committed Feb 9, 2019
commit 482715b0704a8259d1a7a91d5957b43452ccf1cd
3 changes: 1 addition & 2 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ Environment::Environment(IsolateData* isolate_data,
trace_category_state_(isolate_, kTraceCategoryCount),
stream_base_state_(isolate_, StreamBase::kNumStreamBaseStateFields),
flags_(flags),
thread_id_(thread_id == static_cast<uint64_t>(-1) ?
AllocateThreadId() : thread_id),
thread_id_(thread_id == kNoThreadId ? AllocateThreadId() : thread_id),
fs_stats_field_array_(isolate_, kFsStatsBufferLength),
fs_stats_field_bigint_array_(isolate_, kFsStatsBufferLength),
context_(context->GetIsolate(), context) {
Expand Down
3 changes: 2 additions & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class Environment {
Environment(IsolateData* isolate_data,
v8::Local<v8::Context> context,
Flags flags = Flags(),
uint64_t thread_id = static_cast<uint64_t>(-1));
uint64_t thread_id = kNoThreadId);
~Environment();

void Start(bool start_profiler_idle_notifier);
Expand Down Expand Up @@ -771,6 +771,7 @@ class Environment {
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;
Expand Down