diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-05-25 09:36:01 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-05-25 18:51:41 +0300 |
commit | e2a2e9aad923bb2288baf18aad8d38d925f56fa1 (patch) | |
tree | 396fd2b95cb20afb9b43daf4e5d61dadfa42bcd4 /pthread_support.c | |
parent | ac6d028f896c3bff209a7e84fc25157a8cd55d6e (diff) | |
download | bdwgc-e2a2e9aad923bb2288baf18aad8d38d925f56fa1.tar.gz |
Fix assertion violation in GC_allow_register_threads on Windows
(fix of commit ab93e03de)
* pthread_support.c [GC_ASSERTIONS] (GC_allow_register_threads): Wrap
GC_lookup_thread() call into LOCK/UNLOCK.
* win32_threads.c [GC_ASSERTIONS] (GC_allow_register_threads): Wrap
GC_lookup_thread_inner() call into LOCK/UNLOCK.
Diffstat (limited to 'pthread_support.c')
-rw-r--r-- | pthread_support.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pthread_support.c b/pthread_support.c index f18a154f..ec2b5f64 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -2048,9 +2048,15 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, GC_API void GC_CALL GC_allow_register_threads(void) { +# ifdef GC_ASSERTIONS + DCL_LOCK_STATE; + /* Check GC is initialized and the current thread is registered. */ + LOCK(); /* just to match that in win32_threads.c */ GC_ASSERT(GC_lookup_thread(pthread_self()) != 0); - set_need_to_lock(); + UNLOCK(); +# endif + set_need_to_lock(); } GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb) |