Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 34c685b

Browse filesBrowse files
addaleaxrvagg
authored andcommitted
tracing: use ‘real’ atomics
Use actual atomic operations instead of things that are named as if they were atomics, but aren’t. Refs: #26100 PR-URL: #26156 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
1 parent 54896a6 commit 34c685b
Copy full SHA for 34c685b

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Open diff view settings
Collapse file

‎src/tracing/trace_event.h‎

Copy file name to clipboardExpand all lines: src/tracing/trace_event.h
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "node_platform.h"
99
#include "v8-platform.h"
1010
#include "trace_event_common.h"
11+
#include <atomic>
1112

1213
// This header file defines implementation details of how the trace macros in
1314
// trace_event_common.h collect and store trace events. Anything not
@@ -128,9 +129,10 @@ enum CategoryGroupEnabledFlags {
128129
#define TRACE_EVENT_API_ADD_METADATA_EVENT node::tracing::AddMetadataEvent
129130

130131
// Defines atomic operations used internally by the tracing system.
131-
#define TRACE_EVENT_API_ATOMIC_WORD intptr_t
132-
#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var)
133-
#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var) = (value)
132+
#define TRACE_EVENT_API_ATOMIC_WORD std::atomic<intptr_t>
133+
#define TRACE_EVENT_API_ATOMIC_WORD_VALUE intptr_t
134+
#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var).load()
135+
#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var).store(value)
134136

135137
////////////////////////////////////////////////////////////////////////////////
136138

@@ -157,12 +159,12 @@ enum CategoryGroupEnabledFlags {
157159
category_group_enabled = \
158160
TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \
159161
TRACE_EVENT_API_ATOMIC_STORE( \
160-
atomic, reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( \
162+
atomic, reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD_VALUE>( \
161163
category_group_enabled)); \
162164
}
163165

164166
#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \
165-
static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \
167+
static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) {0}; \
166168
const uint8_t* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \
167169
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \
168170
category_group, INTERNAL_TRACE_EVENT_UID(atomic), \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.