Skip to content

Commit

Permalink
Fix: init schedulers before we spawn fibers (#14339)
Browse files Browse the repository at this point in the history
The signal and interrupt handlers spawn fibers, and should be setup after we
properly start the fiber schedulers.

This is working today because we lazily start schedulers for a thread, and we
happen to not have recursive dependencies.
  • Loading branch information
ysbaddaden committed Mar 1, 2024
1 parent 770e415 commit ee70ebb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/kernel.cr
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,6 @@ end
{% end %}

{% unless flag?(:interpreted) || flag?(:wasm32) %}
{% if flag?(:win32) %}
Crystal::System::Process.start_interrupt_loop
{% else %}
Crystal::System::Signal.setup_default_handlers
{% end %}

# load debug info on start up of the program is executed with CRYSTAL_LOAD_DEBUG_INFO=1
# this will make debug info available on print_frame that is used by Crystal's segfault handler
#
Expand All @@ -579,4 +573,10 @@ end
Exception::CallStack.setup_crash_handler

Crystal::Scheduler.init

{% if flag?(:win32) %}
Crystal::System::Process.start_interrupt_loop
{% else %}
Crystal::System::Signal.setup_default_handlers
{% end %}
{% end %}

0 comments on commit ee70ebb

Please sign in to comment.