instance method
Ractor::Port#close
() -> void
port.close
ractor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ractor.rb, line 806
def close
__builtin_cexpr! %q{
ractor_port_close(ec, self)
}
end
Closes the port. Sending to a closed port is prohibited. Receiving is also prohibited if there are no messages in its message queue.
Only the Ractor which created the port is allowed to close it.
Example
port = Ractor::Port.new Ractor.new port do |port| port.close #=> closing port by other ractors is not allowed (Ractor::Error) end.join