Skip to content

Commit d9e4b00

Browse files
committed
fine tune atomics to enusre all tests pass and add comment about why it's here
1 parent 6024eaa commit d9e4b00

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

multidict/_multilib/state.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ get_mod_state_by_def(PyObject *self)
130130
static inline uint64_t
131131
NEXT_VERSION(mod_state *state)
132132
{
133-
return atomic_fetch_add_explicit(
134-
&state->global_version, 1, memory_order_relaxed) +
135-
1;
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;
136137
}
137138

138139
#ifdef __cplusplus

0 commit comments

Comments
 (0)