Skip to content

Commit

Permalink
Fix GC sig_suspend, sig_resume for gc_none (#15382)
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.

(cherry picked from commit 0fbdcc9)

Co-authored-by: Julien Portalier <julien@portalier.com>
  • Loading branch information
github-actions[bot] and ysbaddaden authored Jan 28, 2025
1 parent 0ba7a4d commit 6b1f07c
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 6b1f07c

Please sign in to comment.