From: Ivan Maidanski Date: Fri, 17 Nov 2017 17:36:47 +0000 (+0300) Subject: Allow to turn on spin locking even if thread-local allocations are used X-Git-Tag: v8.0.0~508 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7878157e464d955fa209e3cbd1d13e98853fd1f4;p=gc 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. --- 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);