diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-03-10 07:38:33 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-03-10 11:39:53 +0300 |
commit | 5a8c02852532169ad81a87b553dc5fb3142d9e61 (patch) | |
tree | 60e98a51cab583de1e44cf712ec86b5481809565 /pthread_support.c | |
parent | 1908d8242271880100f24bb685919b3e6a0c1b2f (diff) | |
download | bdwgc-5a8c02852532169ad81a87b553dc5fb3142d9e61.tar.gz |
Fix GC_thread_is_registered for finished threads
(fix of commit 83c1eecd0)
A finished thread may still stay in GC_threads, but it is no longer
considered during a garbage collection phase, thus
GC_thread_is_registered() should return false in such a case.
* include/gc/gc.h [GC_THREADS] (GC_thread_is_registered): Refine
comment (describe the case when the thread is marked as finished).
* pthread_support.c (GC_thread_is_registered): Define and set me local
variable; return FALSE if KNOWN_FINISHED(me).
Diffstat (limited to 'pthread_support.c')
-rw-r--r-- | pthread_support.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pthread_support.c b/pthread_support.c index 63daff2b..1bd48eab 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -856,7 +856,9 @@ STATIC GC_thread GC_self_thread(void) { GC_API int GC_CALL GC_thread_is_registered(void) { - return GC_self_thread() != NULL; + GC_thread me = GC_self_thread(); + + return me != NULL && !KNOWN_FINISHED(me); } #ifndef GC_WIN32_THREADS |