summaryrefslogtreecommitdiff
path: root/src/env-inl.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-03-18 13:30:49 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-22 00:44:25 +0100
commitd812dbb495a2471f7835c330b49c1d8f3fa8e5c2 (patch)
tree27150b3d5fcb8ee843994d5f3a9f34e19a1438f2 /src/env-inl.h
parentde3b164f4fd069ecfcf496609466fdc85838c08f (diff)
downloadandroid-node-v8-d812dbb495a2471f7835c330b49c1d8f3fa8e5c2.tar.gz
android-node-v8-d812dbb495a2471f7835c330b49c1d8f3fa8e5c2.tar.bz2
android-node-v8-d812dbb495a2471f7835c330b49c1d8f3fa8e5c2.zip
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 <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'src/env-inl.h')
-rw-r--r--src/env-inl.h10
1 files changed, 9 insertions, 1 deletions
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)