Skip to content

PythonQt.QtCore.QWaitCondition · declarations 001

Back to PythonQt.QtCore.QWaitCondition

wait

wait(lockedMutex: Any, time: Any) -> bool

X.wait(lockedMutex, time) -> bool

Supplemental documentation: Qt 5 reference:

bool QWaitCondition::wait(QMutex *lockedMutex, QDeadlineTimer deadline \= QDeadlineTimer(QDeadlineTimer::Forever))

Releases the lockedMutex and waits on the wait condition. The lockedMutex must be initially locked by the calling thread. If lockedMutex is not in a locked state, the behavior is undefined. If lockedMutex is a recursive mutex, this function returns immediately. The lockedMutex will be unlocked, and the calling thread will block until either of these conditions is met:

  • Another thread signals it using wakeOne() or wakeAll(). This function will return true in this case.
  • the deadline given by deadline is reached. If deadline is QDeadlineTimer::Forever (the default), then the wait will never timeout (the event must be signalled). This function will return false if the wait timed out.

The lockedMutex will be returned to the same locked state. This function is provided to allow the atomic transition from the locked state to the wait state.

This function was introduced in Qt 5.12.

See also wakeOne() and wakeAll().

bool QWaitCondition::wait(QMutex *lockedMutex, unsigned long time)

This is an overloaded function.

bool QWaitCondition::wait(QReadWriteLock *lockedReadWriteLock, QDeadlineTimer deadline \= QDeadlineTimer(QDeadlineTimer::Forever))

Releases the lockedReadWriteLock and waits on the wait condition. The lockedReadWriteLock must be initially locked by the calling thread. If lockedReadWriteLock is not in a locked state, this function returns immediately. The lockedReadWriteLock must not be locked recursively, otherwise this function will not release the lock properly. The lockedReadWriteLock will be unlocked, and the calling thread will block until either of these conditions is met:

  • Another thread signals it using wakeOne() or wakeAll(). This function will return true in this case.
  • the deadline given by deadline is reached. If deadline is QDeadlineTimer::Forever (the default), then the wait will never timeout (the event must be signalled). This function will return false if the wait timed out.

The lockedReadWriteLock will be returned to the same locked state. This function is provided to allow the atomic transition from the locked state to the wait state.

This function was introduced in Qt 5.12.

See also wakeOne() and wakeAll().

bool QWaitCondition::wait(QReadWriteLock *lockedReadWriteLock, unsigned long time)

This is an overloaded function.

Upstream PySide2 reference signatures (binding differences may apply):

wait(self, lockedMutex: PySide2.QtCore.QMutex, deadline: PySide2.QtCore.QDeadlineTimer=...) -> bool
wait(self, lockedMutex: PySide2.QtCore.QMutex, time: int) -> bool
wait(self, lockedReadWriteLock: PySide2.QtCore.QReadWriteLock, deadline: PySide2.QtCore.QDeadlineTimer=...) -> bool
wait(self, lockedReadWriteLock: PySide2.QtCore.QReadWriteLock, time: int) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qwaitcondition.html#wait

wakeAll

wakeAll() -> None

X.wakeAll()

Supplemental documentation: Qt 5 reference:

void QWaitCondition::wakeAll()

Wakes all threads waiting on the wait condition. The order in which the threads are woken up depends on the operating system's scheduling policies and cannot be controlled or predicted.

See also wakeOne().

Upstream PySide2 reference signatures (binding differences may apply):

wakeAll(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qwaitcondition.html#wakeAll

wakeOne

wakeOne() -> None

X.wakeOne()

Supplemental documentation: Qt 5 reference:

void QWaitCondition::wakeOne()

Wakes one thread waiting on the wait condition. The thread that is woken up depends on the operating system's scheduling policies, and cannot be controlled or predicted.

If you want to wake up a specific thread, the solution is typically to use different wait conditions and have different threads wait on different conditions.

See also wakeAll().

Upstream PySide2 reference signatures (binding differences may apply):

wakeOne(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qwaitcondition.html#wakeOne