Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Thread::ConditionVariable#wait

(::Thread::Mutex mutex, ?::Time::_Timeout? timeout) -> ::Integer?
wait(mutex, timeout=nil)

Releases the lock held in mutex and waits; reacquires the lock on wakeup.

If timeout is given, this method returns after timeout seconds passed, even if no other thread doesn’t signal.

Returns the slept result on mutex.

See also #signal #broadcast also in 3.3 · 3.2 · 3.1