diff options
-rw-r--r-- | include/private/gc_locks.h | 6 | ||||
-rw-r--r-- | misc.c | 5 | ||||
-rw-r--r-- | pthread_support.c | 8 | ||||
-rw-r--r-- | win32_threads.c | 8 |
4 files changed, 15 insertions, 12 deletions
diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 4974afac..29e38c97 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -55,9 +55,9 @@ # define NOSERVICE # include <windows.h> # define NO_THREAD (DWORD)(-1) - GC_EXTERN DWORD GC_lock_holder; GC_EXTERN CRITICAL_SECTION GC_allocate_ml; # ifdef GC_ASSERTIONS + GC_EXTERN DWORD GC_lock_holder; # define UNCOND_LOCK() \ { GC_ASSERT(I_DONT_HOLD_LOCK()); \ EnterCriticalSection(&GC_allocate_ml); \ @@ -177,7 +177,9 @@ # define ENTER_GC() GC_collecting = 1; # define EXIT_GC() GC_collecting = 0; GC_INNER void GC_lock(void); - GC_EXTERN unsigned long GC_lock_holder; +# ifdef GC_ASSERTIONS + GC_EXTERN unsigned long GC_lock_holder; +# endif # endif /* GC_PTHREADS with linux_threads.c implementation */ GC_EXTERN GC_bool GC_need_to_lock; @@ -1808,14 +1808,9 @@ GC_API void * GC_CALL GC_call_with_alloc_lock(GC_fn_type fn, void *client_data) # ifdef THREADS LOCK(); - /* FIXME - This looks wrong!! */ - SET_LOCK_HOLDER(); # endif result = (*fn)(client_data); # ifdef THREADS -# ifndef GC_ASSERTIONS - UNSET_LOCK_HOLDER(); -# endif /* o.w. UNLOCK() does it implicitly */ UNLOCK(); # endif return(result); diff --git a/pthread_support.c b/pthread_support.c index e851907f..994a2edf 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -82,9 +82,11 @@ #if !defined(USE_SPIN_LOCK) GC_INNER pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER; #endif -GC_INNER unsigned long GC_lock_holder = NO_THREAD; - /* Used only for assertions, and to prevent */ - /* recursive reentry in the system call wrapper. */ + +#ifdef GC_ASSERTIONS + GC_INNER unsigned long GC_lock_holder = NO_THREAD; + /* Used only for assertions. */ +#endif #if defined(GC_DGUX386_THREADS) # include <sys/dg_sys_info.h> diff --git a/win32_threads.c b/win32_threads.c index 4fd1d928..c16946b7 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -32,11 +32,15 @@ /* Allocation lock declarations. */ #if !defined(USE_PTHREAD_LOCKS) GC_INNER CRITICAL_SECTION GC_allocate_ml; - GC_INNER DWORD GC_lock_holder = NO_THREAD; +# ifdef GC_ASSERTIONS + GC_INNER DWORD GC_lock_holder = NO_THREAD; /* Thread id for current holder of allocation lock */ +# endif #else GC_INNER pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER; - GC_INNER unsigned long GC_lock_holder = NO_THREAD; +# ifdef GC_ASSERTIONS + GC_INNER unsigned long GC_lock_holder = NO_THREAD; +# endif #endif #undef CreateThread |