Skip to content

Commit

Permalink
Fix GC sig_suspend, sig_resume for gc_none (#15349)
Browse files Browse the repository at this point in the history
The gc_none interface doesn't define the `sig_suspend` nor `sig_resume` class methods. The program should still compile but commit 57017f6 improperly checks for the method existence, and the methods are always required and compilation fails.
  • Loading branch information
ysbaddaden authored Jan 17, 2025
1 parent 811cb79 commit 0fbdcc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/crystal/system/unix/pthread.cr
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,16 @@ module Crystal::System::Thread
{% end %}

def self.sig_suspend : ::Signal
if GC.responds_to?(:sig_suspend)
GC.sig_suspend
if (gc = GC).responds_to?(:sig_suspend)
gc.sig_suspend
else
::Signal.new(SIG_SUSPEND)
end
end

def self.sig_resume : ::Signal
if GC.responds_to?(:sig_resume)
GC.sig_resume
if (gc = GC).responds_to?(:sig_resume)
gc.sig_resume
else
::Signal.new(SIG_RESUME)
end
Expand Down

0 comments on commit 0fbdcc9

Please sign in to comment.