@@ -465,15 +465,13 @@ JL_DLLEXPORT jl_task_t *jl_task_get_next(jl_value_t *trypoptask, jl_value_t *q,
465465 if (set_not_sleeping (ptls )) {
466466 JL_PROBE_RT_SLEEP_CHECK_TASK_WAKE (ptls );
467467 }
468- if (task )
469- return task ;
470- continue ;
468+ continue ; // jump to JL_CATCH
471469 }
472470 if (task ) {
473471 if (set_not_sleeping (ptls )) {
474472 JL_PROBE_RT_SLEEP_CHECK_TASK_WAKE (ptls );
475473 }
476- return task ;
474+ continue ; // jump to JL_CATCH
477475 }
478476
479477 // IO is always permitted, but outside a threaded region, only
@@ -533,7 +531,7 @@ JL_DLLEXPORT jl_task_t *jl_task_get_next(jl_value_t *trypoptask, jl_value_t *q,
533531 JL_PROBE_RT_SLEEP_CHECK_UV_WAKE (ptls );
534532 }
535533 start_cycles = 0 ;
536- continue ;
534+ continue ; // jump to JL_CATCH
537535 }
538536 if (!enter_eventloop && !jl_atomic_load_relaxed (& _threadedregion ) && ptls -> tid == jl_atomic_load_relaxed (& io_loop_tid )) {
539537 // thread 0 is the only thread permitted to run the event loop
@@ -542,7 +540,7 @@ JL_DLLEXPORT jl_task_t *jl_task_get_next(jl_value_t *trypoptask, jl_value_t *q,
542540 JL_PROBE_RT_SLEEP_CHECK_UV_WAKE (ptls );
543541 }
544542 start_cycles = 0 ;
545- continue ;
543+ continue ; // jump to JL_CATCH
546544 }
547545 }
548546
@@ -596,16 +594,18 @@ JL_DLLEXPORT jl_task_t *jl_task_get_next(jl_value_t *trypoptask, jl_value_t *q,
596594 if (task ) {
597595 assert (task == wait_empty );
598596 wait_empty = NULL ;
599- return task ;
597+ continue ;
600598 }
601599 }
602- JL_CATCH { // probably SIGINT, but possibly a user mistake in trypoptask
600+ JL_CATCH {
601+ // probably SIGINT, but possibly a user mistake in trypoptask
603602 if (!isrunning )
604603 jl_atomic_fetch_add_relaxed (& nrunning , 1 );
605604 set_not_sleeping (ptls );
606- // TODO: if (task != NULL) instead attach this exception there, so that we don't forgot to ever reschedule it
607605 jl_rethrow ();
608606 }
607+ if (task )
608+ return task ;
609609 }
610610 else {
611611 // maybe check the kernel for new messages too
0 commit comments