Skip to content

PythonQt.QtCore.QReadWriteLock · declarations 001

Back to PythonQt.QtCore.QReadWriteLock

lockForRead

lockForRead() -> None

X.lockForRead()

Supplemental documentation: Qt 5 reference:

void QReadWriteLock::lockForRead()

Locks the lock for reading. This function will block the current thread if another thread has locked for writing.

It is not possible to lock for read if the thread already has locked for write.

See also unlock(), lockForWrite(), and tryLockForRead().

Upstream PySide2 reference signatures (binding differences may apply):

lockForRead(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qreadwritelock.html#lockForRead

lockForWrite

lockForWrite() -> None

X.lockForWrite()

Supplemental documentation: Qt 5 reference:

void QReadWriteLock::lockForWrite()

Locks the lock for writing. This function will block the current thread if another thread (including the current) has locked for reading or writing (unless the lock has been created using the QReadWriteLock::Recursive mode).

It is not possible to lock for write if the thread already has locked for read.

See also unlock(), lockForRead(), and tryLockForWrite().

Upstream PySide2 reference signatures (binding differences may apply):

lockForWrite(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qreadwritelock.html#lockForWrite

tryLockForRead

tryLockForRead(timeout: Any) -> bool

X.tryLockForRead(timeout) -> bool

Supplemental documentation: Qt 5 reference:

bool QReadWriteLock::tryLockForRead()

Attempts to lock for reading. If the lock was obtained, this function returns true, otherwise it returns false instead of waiting for the lock to become available, i.e. it does not block.

The lock attempt will fail if another thread has locked for writing.

If the lock was obtained, the lock must be unlocked with unlock() before another thread can successfully lock it for writing.

It is not possible to lock for read if the thread already has locked for write.

See also unlock() and lockForRead().

bool QReadWriteLock::tryLockForRead(int timeout)

This is an overloaded function.

Attempts to lock for reading. This function returns true if the lock was obtained; otherwise it returns false. If another thread has locked for writing, this function will wait for at most timeout milliseconds for the lock to become available.

Note: Passing a negative number as the timeout is equivalent to calling lockForRead(), i.e. this function will wait forever until lock can be locked for reading when timeout is negative.

If the lock was obtained, the lock must be unlocked with unlock() before another thread can successfully lock it for writing.

It is not possible to lock for read if the thread already has locked for write.

See also unlock() and lockForRead().

Upstream PySide2 reference signatures (binding differences may apply):

tryLockForRead(self) -> bool
tryLockForRead(self, timeout: int) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qreadwritelock.html#tryLockForRead

tryLockForWrite

tryLockForWrite(timeout: Any) -> bool

X.tryLockForWrite(timeout) -> bool

Supplemental documentation: Qt 5 reference:

bool QReadWriteLock::tryLockForWrite()

Attempts to lock for writing. If the lock was obtained, this function returns true; otherwise, it returns false immediately.

The lock attempt will fail if another thread has locked for reading or writing.

If the lock was obtained, the lock must be unlocked with unlock() before another thread can successfully lock it.

It is not possible to lock for write if the thread already has locked for read.

See also unlock() and lockForWrite().

bool QReadWriteLock::tryLockForWrite(int timeout)

This is an overloaded function.

Attempts to lock for writing. This function returns true if the lock was obtained; otherwise it returns false. If another thread has locked for reading or writing, this function will wait for at most timeout milliseconds for the lock to become available.

Note: Passing a negative number as the timeout is equivalent to calling lockForWrite(), i.e. this function will wait forever until lock can be locked for writing when timeout is negative.

If the lock was obtained, the lock must be unlocked with unlock() before another thread can successfully lock it.

It is not possible to lock for write if the thread already has locked for read.

See also unlock() and lockForWrite().

Upstream PySide2 reference signatures (binding differences may apply):

tryLockForWrite(self) -> bool
tryLockForWrite(self, timeout: int) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qreadwritelock.html#tryLockForWrite

unlock

unlock() -> None

X.unlock()

Supplemental documentation: Qt 5 reference:

void QReadWriteLock::unlock()

Unlocks the lock.

Attempting to unlock a lock that is not locked is an error, and will result in program termination.

See also lockForRead(), lockForWrite(), tryLockForRead(), and tryLockForWrite().

Upstream PySide2 reference signatures (binding differences may apply):

unlock(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qreadwritelock.html#unlock