mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-13 11:18:48 +00:00
Use good locks in dlmalloc
Using mere spin locks causes runitd.com to go painstakingly slow on NetBSD for reasons that aren't clear yet.
This commit is contained in:
parent
80fca1f7c3
commit
1a28e35c62
2 changed files with 4 additions and 1 deletions
1
third_party/dlmalloc/dlmalloc.c
vendored
1
third_party/dlmalloc/dlmalloc.c
vendored
|
@ -32,6 +32,7 @@
|
|||
#define HAVE_MREMAP 0
|
||||
#define HAVE_MORECORE 0
|
||||
#define USE_LOCKS 2
|
||||
#define USE_SPIN_LOCKS 0
|
||||
#define MORECORE_CONTIGUOUS 0
|
||||
#define MALLOC_INSPECT_ALL 1
|
||||
#define ABORT_ON_ASSERT_FAILURE 0
|
||||
|
|
4
third_party/dlmalloc/locks.inc
vendored
4
third_party/dlmalloc/locks.inc
vendored
|
@ -29,7 +29,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef USE_SPIN_LOCKS
|
||||
#if USE_SPIN_LOCKS
|
||||
|
||||
#define MLOCK_T atomic_uint
|
||||
|
||||
|
@ -62,11 +62,13 @@ static int malloc_wipe(MLOCK_T *lk) {
|
|||
}
|
||||
|
||||
static int malloc_lock(MLOCK_T *lk) {
|
||||
if (!__threaded) return 0;
|
||||
nsync_mu_lock(lk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int malloc_unlock(MLOCK_T *lk) {
|
||||
if (!__threaded) return 0;
|
||||
nsync_mu_unlock(lk);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue