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:
Justine Tunney 2023-12-28 04:55:50 -08:00
parent 80fca1f7c3
commit 1a28e35c62
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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;
}