Disable malloc mutex when not using threads

This commit is contained in:
Justine Tunney 2022-06-11 19:18:09 -07:00
parent 517267a577
commit 29af890efa

View file

@ -1,4 +1,5 @@
// clang-format off // clang-format off
#include "libc/nexgen32e/threaded.h"
/* --------------------------- Lock preliminaries ------------------------ */ /* --------------------------- Lock preliminaries ------------------------ */
@ -100,8 +101,8 @@ static dontinline int spin_acquire_lock(int *sl) {
#define MLOCK_T int #define MLOCK_T int
#define TRY_LOCK(sl) !CAS_LOCK(sl) #define TRY_LOCK(sl) !CAS_LOCK(sl)
#define RELEASE_LOCK(sl) CLEAR_LOCK(sl) #define RELEASE_LOCK(sl) if (__threaded) CLEAR_LOCK(sl)
#define ACQUIRE_LOCK(sl) (CAS_LOCK(sl)? spin_acquire_lock(sl) : 0) #define ACQUIRE_LOCK(sl) (__threaded && CAS_LOCK(sl) ? spin_acquire_lock(sl) : 0)
#define INITIAL_LOCK(sl) (*sl = 0) #define INITIAL_LOCK(sl) (*sl = 0)
#define DESTROY_LOCK(sl) (0) #define DESTROY_LOCK(sl) (0)
static MLOCK_T malloc_global_mutex = 0; static MLOCK_T malloc_global_mutex = 0;