class Ractor::ClosedError - Documentation for Ruby 4.0
Description: class Ractor::ClosedError: Raised when an attempt is made to send a message to a closed port, or to retrieve a message from a closed and empty port. Port#close and are closed im
Keywords: ruby,class,Ractor::ClosedError

🔍

No recent searches

# class Ractor::ClosedError

Raised when an attempt is made to send a message to a closed port, or to retrieve a message from a closed and empty port. Ports may be closed explicitly with `Ractor::Port#close` and are closed implicitly when a `Ractor` terminates.

    port = Ractor::Port.new
    port.close
    port << "test"  # Ractor::ClosedError
    port.receive    # Ractor::ClosedError

`ClosedError` is a descendant of `StopIteration`, so the closing of a port will break out of loops without propagating the error.