From 9f572645938f2312693a37176af5eacc1dd8d317 Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Tue, 5 Jan 2016 13:57:37 -0500 Subject: [PATCH] Explicitly initialize GC state --- src/threading.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/threading.c b/src/threading.c index 2655987101961..09bf8f8468a1d 100644 --- a/src/threading.c +++ b/src/threading.c @@ -143,15 +143,17 @@ struct _jl_thread_heap_t *jl_mk_thread_heap(void); static void ti_initthread(int16_t tid) { - ti_tid = tid; - jl_pgcstack = NULL; + jl_tls_states_t *ptls = jl_get_ptls_states(); + ptls->tid = tid; + ptls->pgcstack = NULL; + ptls->gc_state = 0; // GC unsafe #ifdef JULIA_ENABLE_THREADING jl_all_heaps[tid] = jl_mk_thread_heap(); #else jl_mk_thread_heap(); #endif - jl_all_task_states[tid].ptls = jl_get_ptls_states(); + jl_all_task_states[tid].ptls = ptls; jl_all_task_states[tid].signal_stack = jl_install_thread_signal_handler(); }