move lock code to atomic.h

This commit is contained in:
Daan Leijen 2024-06-01 17:25:45 -07:00
parent 0b3cd51249
commit f93fb900b7
8 changed files with 92 additions and 174 deletions

View file

@ -9,7 +9,6 @@ terms of the MIT license. A copy of the license can be found in the file
#include "mimalloc.h"
#include "mimalloc/internal.h"
#include "mimalloc/atomic.h"
#include "mimalloc/prim.h"
#include <stdio.h> // fputs, stderr
@ -563,24 +562,6 @@ bool _mi_prim_getenv(const char* name, char* result, size_t result_size) {
}
//----------------------------------------------------------------
// Locks
//----------------------------------------------------------------
bool _mi_prim_lock(mi_lock_t* lock) {
EnterCriticalSection(lock);
return true;
}
bool _mi_prim_try_lock(mi_lock_t* lock) {
return TryEnterCriticalSection(lock);
}
void _mi_prim_unlock(mi_lock_t* lock) {
LeaveCriticalSection(lock);
}
//----------------------------------------------------------------
// Random
//----------------------------------------------------------------