lua-bson atomic #1317

This commit is contained in:
Cloud Wu
2021-01-11 17:30:04 +08:00
parent 1e5e8354d7
commit 933dbbd570

View File

@@ -1245,11 +1245,11 @@ typeclosure(lua_State *L) {
} }
static uint8_t oid_header[5]; static uint8_t oid_header[5];
static uint32_t oid_counter; static ATOM_ULONG oid_counter;
static void static void
init_oid_header() { init_oid_header() {
if (oid_counter) { if (ATOM_LOAD(&oid_counter)) {
// already init // already init
return; return;
} }
@@ -1273,7 +1273,7 @@ init_oid_header() {
if (c == 0) { if (c == 0) {
c = 1; c = 1;
} }
oid_counter = c; ATOM_STORE(&oid_counter, c);
} }
static inline int static inline int