From 34c685b406f4292518d72f200a1d1d7498c3012c Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 16 Feb 2019 23:51:02 +0100 Subject: [PATCH] =?UTF-8?q?tracing:=20use=20=E2=80=98real=E2=80=99=20atomi?= =?UTF-8?q?cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use actual atomic operations instead of things that are named as if they were atomics, but aren’t. Refs: https://github.com/nodejs/node/issues/26100 PR-URL: https://github.com/nodejs/node/pull/26156 Reviewed-By: Gus Caplan Reviewed-By: Yang Guo Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Eugene Ostroukhov --- src/tracing/trace_event.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tracing/trace_event.h b/src/tracing/trace_event.h index d5d4befb14600a..590cb592fc054f 100644 --- a/src/tracing/trace_event.h +++ b/src/tracing/trace_event.h @@ -8,6 +8,7 @@ #include "node_platform.h" #include "v8-platform.h" #include "trace_event_common.h" +#include // This header file defines implementation details of how the trace macros in // trace_event_common.h collect and store trace events. Anything not @@ -128,9 +129,10 @@ enum CategoryGroupEnabledFlags { #define TRACE_EVENT_API_ADD_METADATA_EVENT node::tracing::AddMetadataEvent // Defines atomic operations used internally by the tracing system. -#define TRACE_EVENT_API_ATOMIC_WORD intptr_t -#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var) -#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var) = (value) +#define TRACE_EVENT_API_ATOMIC_WORD std::atomic +#define TRACE_EVENT_API_ATOMIC_WORD_VALUE intptr_t +#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var).load() +#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var).store(value) //////////////////////////////////////////////////////////////////////////////// @@ -157,12 +159,12 @@ enum CategoryGroupEnabledFlags { category_group_enabled = \ TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \ TRACE_EVENT_API_ATOMIC_STORE( \ - atomic, reinterpret_cast( \ + atomic, reinterpret_cast( \ category_group_enabled)); \ } #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ - static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ + static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) {0}; \ const uint8_t* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \ category_group, INTERNAL_TRACE_EVENT_UID(atomic), \