mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
use atomic yield on delayed-freeing; clarify code
This commit is contained in:
parent
3bbbe6c686
commit
66818bf632
4 changed files with 39 additions and 38 deletions
|
@ -277,12 +277,12 @@ static void run_os_threads(size_t nthreads) {
|
|||
#ifdef __cplusplus
|
||||
#include <atomic>
|
||||
static void* atomic_exchange_ptr(volatile void** p, void* newval) {
|
||||
return std::atomic_exchange_explicit((volatile std::atomic<void*>*)p, newval, std::memory_order_acquire);
|
||||
return std::atomic_exchange((volatile std::atomic<void*>*)p, newval);
|
||||
}
|
||||
#else
|
||||
#include <stdatomic.h>
|
||||
static void* atomic_exchange_ptr(volatile void** p, void* newval) {
|
||||
return atomic_exchange_explicit((volatile _Atomic(void*)*)p, newval, memory_order_acquire);
|
||||
return atomic_exchange((volatile _Atomic(void*)*)p, newval);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue