Skip to content

Commit 9f57264

Browse files
committed
Explicitly initialize GC state
1 parent c061f92 commit 9f57264

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/threading.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,17 @@ struct _jl_thread_heap_t *jl_mk_thread_heap(void);
143143

144144
static void ti_initthread(int16_t tid)
145145
{
146-
ti_tid = tid;
147-
jl_pgcstack = NULL;
146+
jl_tls_states_t *ptls = jl_get_ptls_states();
147+
ptls->tid = tid;
148+
ptls->pgcstack = NULL;
149+
ptls->gc_state = 0; // GC unsafe
148150
#ifdef JULIA_ENABLE_THREADING
149151
jl_all_heaps[tid] = jl_mk_thread_heap();
150152
#else
151153
jl_mk_thread_heap();
152154
#endif
153155

154-
jl_all_task_states[tid].ptls = jl_get_ptls_states();
156+
jl_all_task_states[tid].ptls = ptls;
155157
jl_all_task_states[tid].signal_stack = jl_install_thread_signal_handler();
156158
}
157159

0 commit comments

Comments
 (0)