select(*ports, timeout: nil) -> [object, object] | nilRuby 3.0 から[permalink][rdoc][edit](?) → Array[untyped]-
引数で指定した Ractor または Ractor::Port のいずれかが受信可能になるまで待ち、受信可能になったものと受信した値の配列を返します。
timeoutを指定した場合、その秒数が経過しても受信可能になったものが無ければ nil を返します。- [PARAM]
ports: - 待つ対象の Ractor または Ractor::Port を指定します。
- [PARAM]
timeout: - 待つ秒数を数値で指定します。nil の場合は、受信可能になるまで待ち続けます。
- [EXCEPTION]
ArgumentError: -
timeoutが負の場合や、待つ対象を 1 つも指定しなかった場合に発生します。
port = Ractor::Port.new p Ractor.select(port, timeout: 0.1) # => nil - [PARAM]