Skip to content

Commit

Permalink
src: initialize fields accessed by AsyncHooks before AsyncHooks
Browse files Browse the repository at this point in the history
PR-URL: nodejs#48566
  • Loading branch information
jkrems committed Jun 27, 2023
1 parent 32eb492 commit 29d9d7c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/env.h
Expand Up @@ -1015,6 +1015,10 @@ class Environment : public MemoryRetainer {
uv_async_t task_queues_async_;
int64_t task_queues_async_refs_ = 0;

// These are read by the AsyncHooks ctor and need to be listed before async_hooks_.
std::atomic_bool is_stopping_{false};
std::atomic_bool can_call_into_js_{true};

AsyncHooks async_hooks_;
ImmediateInfo immediate_info_;
AliasedInt32Array timeout_info_;
Expand Down Expand Up @@ -1092,7 +1096,6 @@ class Environment : public MemoryRetainer {

bool has_serialized_options_ = false;

std::atomic_bool can_call_into_js_ { true };
uint64_t flags_;
uint64_t thread_id_;
std::unordered_set<worker::Worker*> sub_worker_contexts_;
Expand Down Expand Up @@ -1150,8 +1153,6 @@ class Environment : public MemoryRetainer {
CleanupQueue cleanup_queue_;
bool started_cleanup_ = false;

std::atomic_bool is_stopping_ { false };

std::unordered_set<int> unmanaged_fds_;

std::function<void(Environment*, ExitCode)> process_exit_handler_{
Expand Down

0 comments on commit 29d9d7c

Please sign in to comment.