Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Ractor#close_outgoing
ractor.close_outgoing → true | false
ractor.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/ractor.rb, line 767
def close_outgoing
__builtin_cexpr! %q{
ractor_close_outgoing(ec, RACTOR_PTR(self));
}
end
Closes the outgoing port and returns whether it was already closed. All further attempts to Ractor.yield in the ractor, and take from the ractor will fail with Ractor::ClosedError.
Example
r = Ractor.new {sleep(500)} r.close_outgoing #=> false r.close_outgoing #=> true r.take # Ractor::ClosedError (The outgoing-port is already closed)