Skip to content

Commit 3ac82ec

Browse files
Vizonexbdraco
andauthored
Update multidict/_multilib/state.h
Co-authored-by: J. Nick Koston <[email protected]>
1 parent d9e4b00 commit 3ac82ec

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

multidict/_multilib/state.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ get_mod_state_by_def(PyObject *self)
130130
static inline uint64_t
131131
NEXT_VERSION(mod_state *state)
132132
{
133-
/* threads have the ability to screw with the global version,
134-
* using an atomic variable ensures the global version is
135-
* always accurate. */
136-
return atomic_fetch_add(&state->global_version, 1) + 1;
133+
/* relaxed is fine here as we only care about the atomicity of the RMW itself */
134+
return atomic_fetch_add_explicit(&state->global_version, 1, memory_order_relaxed) + 1
137135
}
138136

139137
#ifdef __cplusplus

0 commit comments

Comments
 (0)