mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
Disable malloc mutex when not using threads
This commit is contained in:
parent
517267a577
commit
29af890efa
1 changed files with 3 additions and 2 deletions
5
third_party/dlmalloc/locks.inc
vendored
5
third_party/dlmalloc/locks.inc
vendored
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue