mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 02:14:13 +08:00
mdbx: fix safe64_reset()
for platforms without atomic 64-bit compare-and-swap.
This commit is contained in:
parent
b66780633e
commit
39c5e66ed1
12
src/core.c
12
src/core.c
@ -957,16 +957,18 @@ static __always_inline void safe64_reset(MDBX_atomic_uint64_t *p,
|
|||||||
mo_Relaxed) /* atomically make >= SAFE64_INVALID_THRESHOLD */;
|
mo_Relaxed) /* atomically make >= SAFE64_INVALID_THRESHOLD */;
|
||||||
atomic_add32(&p->low, 1) /* avoid ABA in safe64_reset_compare() */;
|
atomic_add32(&p->low, 1) /* avoid ABA in safe64_reset_compare() */;
|
||||||
} else
|
} else
|
||||||
#elif MDBX_64BIT_ATOMIC
|
#endif /* !MDBX_64BIT_CAS */
|
||||||
/* atomically make value >= SAFE64_INVALID_THRESHOLD by 64-bit operation */
|
#if MDBX_64BIT_ATOMIC
|
||||||
atomic_store64(p, UINT64_MAX,
|
/* atomically make value >= SAFE64_INVALID_THRESHOLD by 64-bit operation */
|
||||||
single_writer ? mo_AcquireRelease : mo_SequentialConsistency);
|
atomic_store64(p, UINT64_MAX,
|
||||||
|
single_writer ? mo_AcquireRelease
|
||||||
|
: mo_SequentialConsistency);
|
||||||
#else
|
#else
|
||||||
/* atomically make value >= SAFE64_INVALID_THRESHOLD by 32-bit operation */
|
/* atomically make value >= SAFE64_INVALID_THRESHOLD by 32-bit operation */
|
||||||
atomic_store32(&p->high, UINT32_MAX,
|
atomic_store32(&p->high, UINT32_MAX,
|
||||||
single_writer ? mo_AcquireRelease : mo_SequentialConsistency);
|
single_writer ? mo_AcquireRelease : mo_SequentialConsistency);
|
||||||
#endif /* MDBX_64BIT_ATOMIC */
|
#endif /* MDBX_64BIT_ATOMIC */
|
||||||
assert(p->weak >= SAFE64_INVALID_THRESHOLD);
|
assert(p->weak >= SAFE64_INVALID_THRESHOLD);
|
||||||
mdbx_jitter4testing(true);
|
mdbx_jitter4testing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user