]> granicus.if.org Git - gc/commitdiff
Allow to turn on spin locking even if thread-local allocations are used
authorIvan Maidanski <ivmai@mail.ru>
Fri, 17 Nov 2017 17:36:47 +0000 (20:36 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 17 Nov 2017 17:36:47 +0000 (20:36 +0300)
* 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

index 6b1d1e0a16a4967991878bb7cd56c7162263b3df..fd56fc8425d0bb33870ed87840ab38318cff66de 100644 (file)
 #    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);