Skip to content
instance method

Ractor::Port#close

() -> void
port.close

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
See also #<< #closed? .new #inspect also in 4.1