Ruby 4.1 リファレンスマニュアル

instance method Thread::Monitor#wait_for_cond

wait_for_cond(cond, timeout) -> boolRuby 2.7.0 から[permalink][rdoc][edit]

Thread::Monitor::ConditionVariable 用の内部メソッドです。

[PARAM] cond:
Thread::ConditionVariable を指定します。
[PARAM] timeout:
タイムアウトまでの秒数。指定しなかった場合はタイムアウトしません。
[RETURN]
タイムアウトしたときは false を返します。それ以外は true を返します。
m = Thread::Monitor.new
cv = Thread::ConditionVariable.new
m.enter
m.wait_for_cond(cv, 1)