From 39c3538512a051410cbc2fdafac66274338e754b Mon Sep 17 00:00:00 2001 From: Yorick Hardy Date: Fri, 17 Jan 2025 06:09:43 +0200 Subject: [PATCH] runtime: clear the thread_key before exiting the thread --- runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime.c b/runtime.c index 663cb328..f75b0ca0 100644 --- a/runtime.c +++ b/runtime.c @@ -7189,6 +7189,8 @@ void Cyc_exit_thread(void *data, object _, int argc, object * args) gc_remove_mutator(thd); ck_pr_cas_int((int *)&(thd->thread_state), CYC_THREAD_STATE_RUNNABLE, CYC_THREAD_STATE_TERMINATED); + // we are exiting, the destructor does not need to be called + pthread_setspecific(cyclone_thread_key, (void (*)(void *))NULL); pthread_exit(NULL); }