Skip to content

Commit

Permalink
Fix: undefined method 'sig_suspend' for GC:Module (gc_none)
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 the fallback never used.
  • Loading branch information
ysbaddaden committed Jan 16, 2025
1 parent 7135b1d commit 8b0e61b
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 8b0e61b

Please sign in to comment.