From 7878157e464d955fa209e3cbd1d13e98853fd1f4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 17 Nov 2017 20:36:47 +0300 Subject: [PATCH] Allow to turn on spin locking even if thread-local allocations are used * include/private/gc_locks.h [GC_PTHREADS && !GC_WIN32_THREADS && THREAD_LOCAL_ALLOC && !USE_PTHREAD_LOCKS] (UNCOND_LOCK, UNCOND_UNLOCK): Use spin locks if USE_SPIN_LOCK is defined by client. --- include/private/gc_locks.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 6b1d1e0a..fd56fc84 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -120,11 +120,13 @@ # define NO_THREAD ((unsigned long)(-1l)) /* != NUMERIC_THREAD_ID(pthread_self()) for any thread */ -# if !defined(THREAD_LOCAL_ALLOC) && !defined(USE_PTHREAD_LOCKS) +# if (!defined(THREAD_LOCAL_ALLOC) || defined(USE_SPIN_LOCK)) \ + && !defined(USE_PTHREAD_LOCKS) /* In the THREAD_LOCAL_ALLOC case, the allocation lock tends to */ /* be held for long periods, if it is held at all. Thus spinning */ /* and sleeping for fixed periods are likely to result in */ /* significant wasted time. We thus rely mostly on queued locks. */ +# undef USE_SPIN_LOCK # define USE_SPIN_LOCK GC_EXTERN volatile AO_TS_t GC_allocate_lock; GC_INNER void GC_lock(void); -- 2.40.0