// thread function: used by all except the main thread void jl_threadfun(void *arg) { jl_threadarg_t *targ = (jl_threadarg_t*)arg; // initialize this thread (set tid, create heap, set up root task) jl_init_threadtls(targ->tid); void *stack_lo, *stack_hi; jl_init_stack_limits(0, &stack_lo, &stack_hi); jl_init_root_task(stack_lo, stack_hi); jl_ptls_t ptls = jl_get_ptls_states(); jl_gc_state_set(ptls, JL_GC_STATE_SAFE, 0); uv_barrier_wait(targ->barrier); // free the thread argument here free(targ); (void)jl_gc_unsafe_enter(ptls); jl_current_task->exception = jl_nothing; jl_finish_task(jl_current_task, jl_nothing); // noreturn }
JL_DLLEXPORT int8_t (jl_gc_unsafe_enter)(void) { jl_ptls_t ptls = jl_get_ptls_states(); return jl_gc_unsafe_enter(ptls); }
JL_DLLEXPORT int8_t (jl_gc_unsafe_enter)(void) { return jl_gc_unsafe_enter(); }