File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,7 @@ JL_DLLEXPORT void *jl_threadgroup(void) { return (void *)tgworld; }
422
422
// and run it in all threads
423
423
JL_DLLEXPORT jl_value_t * jl_threading_run (jl_function_t * f , jl_svec_t * args )
424
424
{
425
+ // unmanaged safe
425
426
#if PROFILE_JL_THREADING
426
427
uint64_t tstart = rdtsc ();
427
428
#endif
@@ -433,6 +434,7 @@ JL_DLLEXPORT jl_value_t *jl_threading_run(jl_function_t *f, jl_svec_t *args)
433
434
JL_TYPECHK (jl_threading_run , function , (jl_value_t * )f );
434
435
JL_TYPECHK (jl_threading_run , simplevector , (jl_value_t * )args );
435
436
437
+ int8_t gc_state = jl_gc_unsafe_enter ();
436
438
JL_GC_PUSH2 (& argtypes , & fun );
437
439
if (jl_svec_len (args ) == 0 )
438
440
argtypes = (jl_tupletype_t * )jl_typeof (jl_emptytuple );
@@ -470,15 +472,18 @@ JL_DLLEXPORT jl_value_t *jl_threading_run(jl_function_t *f, jl_svec_t *args)
470
472
user_ticks [ti_tid ] += (trun - tfork );
471
473
#endif
472
474
475
+ jl_gc_state_set (3 , 0 );
473
476
// wait for completion (TODO: nowait?)
474
477
ti_threadgroup_join (tgworld , ti_tid );
478
+ jl_gc_state_set (0 , 3 );
475
479
476
480
#if PROFILE_JL_THREADING
477
481
uint64_t tjoin = rdtsc ();
478
482
join_ticks [ti_tid ] += (tjoin - trun );
479
483
#endif
480
484
481
485
JL_GC_POP ();
486
+ jl_gc_unsafe_leave (gc_state );
482
487
483
488
return tw -> ret ;
484
489
}
You can’t perform that action at this time.
0 commit comments