summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-10-16 00:11:37 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-10-17 12:43:33 +0300
commit70fa0739e2b0e7791063fc6743e9e5aa98d02dad (patch)
tree8cd5bdb2e0262f84a1d0af6538b1fd602907690d /win32_threads.c
parentf970259118e2d9316eff0f59692f5f61363cfe72 (diff)
downloadbdwgc-70fa0739e2b0e7791063fc6743e9e5aa98d02dad.tar.gz
Unify GC_[mark_]lock_holder variable definition
(refactoring) * include/private/gc_locks.h [GC_WIN32_THREADS && !USE_PTHREAD_LOCKS || GC_PTHREADS] (NO_THREAD): Define in a single place. * include/private/gc_locks.h [(GC_WIN32_THREADS && !USE_PTHREAD_LOCKS || GC_PTHREADS) && GC_ASSERTIONS] (UNSET_LOCK_HOLDER): Likewise. * include/private/gc_locks.h [(GC_WIN32_THREADS && !USE_PTHREAD_LOCKS || GC_PTHREADS) && GC_ASSERTIONS] (GC_lock_holder): Declare in a single place. * include/private/gc_locks.h [GC_WIN32_THREADS && !USE_PTHREAD_LOCKS] (NO_THREAD): Change DWORD to unsigned long. * include/private/gc_locks.h [GC_WIN32_THREADS && !USE_PTHREAD_LOCKS && GC_ASSERTIONS] (GC_lock_holder): Likewise. * win32_threads.c [!USE_PTHREAD_LOCKS && GC_ASSERTIONS] (GC_lock_holder): Likewise. * win32_threads.c [PARALLEL_MARK && !GC_PTHREADS_PARAMARK && GC_ASSERTIONS] (GC_mark_lock_holder): Likewise. * include/private/gc_locks.h [(GC_WIN32_THREADS && !USE_PTHREAD_LOCKS || GC_PTHREADS) && GC_ASSERTIONS] (SET_LOCK_HOLDER, UNSET_LOCK_HOLDER): Cast to void. * win32_threads.c [GC_ASSERTIONS] (GC_lock_holder): Define in a single place (in the file).
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/win32_threads.c b/win32_threads.c
index 5a9d018a..11c38d6b 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -23,15 +23,13 @@
/* Allocation lock declarations. */
#if !defined(USE_PTHREAD_LOCKS)
GC_INNER CRITICAL_SECTION GC_allocate_ml;
-# 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;
-# ifdef GC_ASSERTIONS
+#endif
+
+#ifdef GC_ASSERTIONS
GC_INNER unsigned long GC_lock_holder = NO_THREAD;
-# endif
+ /* Thread id for current holder of allocation lock */
#endif
#undef CreateThread
@@ -2205,7 +2203,7 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
}
# ifdef GC_ASSERTIONS
- STATIC DWORD GC_mark_lock_holder = NO_THREAD;
+ STATIC unsigned long GC_mark_lock_holder = NO_THREAD;
# define SET_MARK_LOCK_HOLDER \
(void)(GC_mark_lock_holder = GetCurrentThreadId())
# define UNSET_MARK_LOCK_HOLDER \