diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-09-26 11:01:29 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-09-26 11:01:29 +0300 |
commit | 2f6ad63a58d638920c60b5d7fe7d4a6a63066398 (patch) | |
tree | 8677e5470c053f651a279df56f52adc60d024aeb /pthread_support.c | |
parent | b785014a6f8d6d6afb3521fd235e125c43e6028b (diff) | |
download | bdwgc-2f6ad63a58d638920c60b5d7fe7d4a6a63066398.tar.gz |
Fix removal of dead threads in a child process
GC_threads table may contain several elements with the same pthread id,
so GC_remove_all_threads_but_me should remove all elements except for
the first found element matching the id of the current thread.
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Do not assign me if it is already non-null; add comment.
* win32_threads.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Likewise.
* win32_threads.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Remove GC_ASSERT(me==NULL).
Diffstat (limited to 'pthread_support.c')
-rw-r--r-- | pthread_support.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pthread_support.c b/pthread_support.c index 379848c3..2694ec80 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -754,7 +754,8 @@ STATIC void GC_remove_all_threads_but_me(void) me = 0; for (p = GC_threads[hv]; 0 != p; p = next) { next = p -> next; - if (THREAD_EQUAL(p -> id, self)) { + if (THREAD_EQUAL(p -> id, self) + && me == NULL) { /* ignore dead threads with the same id */ me = p; p -> next = 0; # ifdef GC_DARWIN_THREADS |