# 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); \
# 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;
# 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);
#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>
/* 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