From d812dbb495a2471f7835c330b49c1d8f3fa8e5c2 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 18 Mar 2019 13:30:49 +0100 Subject: src: refactor thread stopping mechanism - Follow style guide for naming, e.g. use lower_snake_case for simple setters/getters. - For performance, use atomics instead of a mutex, and inline the corresponding getter/setter pair. PR-URL: https://github.com/nodejs/node/pull/26757 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann Reviewed-By: Michael Dawson --- src/env-inl.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/env-inl.h') diff --git a/src/env-inl.h b/src/env-inl.h index 1197115318..ffba6a2843 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -717,7 +717,7 @@ inline void Environment::remove_sub_worker_context(worker::Worker* context) { } inline bool Environment::is_stopping() const { - return thread_stopper_.IsStopped(); + return thread_stopper_.is_stopped(); } inline performance::performance_state* Environment::performance_state() { @@ -983,6 +983,14 @@ void Environment::ForEachBaseObject(T&& iterator) { } } +bool AsyncRequest::is_stopped() const { + return stopped_.load(); +} + +void AsyncRequest::set_stopped(bool flag) { + stopped_.store(flag); +} + #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) -- cgit v1.2.3