Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Ractor#close_outgoing

ractor.close_outgoing → true | false

Closes the outgoing port and returns its previous state. 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)
See also #close_incoming #inspect #[]= #name also in 3.4 · 3.3 · 3.1 · 3.0