wip: initial delayed purging of arenas
This commit is contained in:
@@ -284,6 +284,17 @@ static inline bool mi_atomic_once( mi_atomic_once_t* once ) {
|
||||
return mi_atomic_cas_strong_acq_rel(once, &expected, 1); // try to set to 1
|
||||
}
|
||||
|
||||
typedef _Atomic(uintptr_t) mi_atomic_guard_t;
|
||||
|
||||
// Allows only one thread to execute at a time
|
||||
#define mi_atomic_guard(guard) \
|
||||
uintptr_t _mi_guard_expected = 0; \
|
||||
for(bool _mi_guard_once = true; \
|
||||
_mi_guard_once && mi_atomic_cas_strong_acq_rel(guard,&_mi_guard_expected,1); \
|
||||
(mi_atomic_store_release(guard,0), _mi_guard_once = false) )
|
||||
|
||||
|
||||
|
||||
// Yield
|
||||
#if defined(__cplusplus)
|
||||
#include <thread>
|
||||
|
||||
Reference in New Issue
Block a user