Condition.wait releases an acquired condition lock while a coroutine waits for notification, then reacquires the lock before continuing. A condition combines lock-based exclusive access with event-style notification for shared resources and more selective coordination. section 11.5
Use the wait cycle to coordinate workers safely:
- Acquire the condition before calling wait. section 11.5
- Call await condition.wait() to release the lock and block until notification. section 11.5
- Let another coroutine acquire the condition and call notify_all(). section 11.5
Waiting for a connection state
An execute coroutine can hold a condition, call wait_for(_is_initialized), and pause until initialization changes the connection state to INITIALIZED. Multiple queries can wait without accessing the connection prematurely.



