Skip to content

Commit a6cb643

Browse files
author
Christian Hergert
committed
counters: use bson_sync_synchronize() for memory barrier.
1 parent 4b4af1a commit a6cb643

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mongoc/mongoc-counters-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ mongoc_counter_##ident##_reset (void) \
111111
for (i = 0; i < NCPU; i++) { \
112112
__mongoc_counter_##ident.cpus[i].slots[COUNTER_##ident%SLOTS_PER_CACHELINE] = 0; \
113113
} \
114-
__sync_synchronize (); \
114+
bson_sync_synchronize(); \
115115
}
116116
#include "mongoc-counters.defs"
117117
#undef COUNTER

mongoc/mongoc-counters.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ mongoc_counters_register (mongoc_counters_t *counters,
238238
infos->name[sizeof infos->name-1] = '\0';
239239
infos->description[sizeof infos->description-1] = '\0';
240240

241-
__sync_synchronize ();
241+
bson_sync_synchronize();
242242

243243
counters->n_counters++;
244244

@@ -291,6 +291,6 @@ mongoc_counters_init (void)
291291
* we have initialized the rest of the counters. Don't forget our memory
292292
* barrier to prevent compiler reordering.
293293
*/
294-
__sync_synchronize ();
294+
bson_sync_synchronize();
295295
counters->size = size;
296296
}

0 commit comments

Comments
 (0)