summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-12-01 08:24:17 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-03-14 11:36:41 +0300
commit0519265b7aac7e57a012611b7f7a80eb2bfd1e55 (patch)
tree8568353bc2ce5d69e76616f4f1bcdea92015c4e4
parent4923759b9446aa2da22a19720b3904ca688295b1 (diff)
downloadbdwgc-0519265b7aac7e57a012611b7f7a80eb2bfd1e55.tar.gz
Fix unregistering of thread created by intercepted pthread_create on NaCl
(a cherry-pick of commit ee779ffc5 from 'master') * pthread_start.c [GC_PTHREADS && !GC_WIN32_THREADS && NACL] (GC_pthread_start_inner): Call GC_thread_exit_proc(me) before return.
-rw-r--r--pthread_start.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pthread_start.c b/pthread_start.c
index d99026b0..c1f6a5fe 100644
--- a/pthread_start.c
+++ b/pthread_start.c
@@ -60,10 +60,12 @@ GC_INNER_PTHRSTART void * GC_CALLBACK GC_inner_start_routine(
# endif
me -> status = result;
GC_end_stubborn_change(me); /* cannot use GC_dirty */
-# ifndef NACL
+ /* Cleanup acquires lock, ensuring that we can't exit while */
+ /* a collection that thinks we're alive is trying to stop us. */
+# ifdef NACL
+ GC_thread_exit_proc((void *)me);
+# else
pthread_cleanup_pop(1);
- /* Cleanup acquires lock, ensuring that we can't exit while */
- /* a collection that thinks we're alive is trying to stop us. */
# endif
return result;
}