QgsReadWriteLocker(lock: QReadWriteLock, mode: QgsReadWriteLocker.Mode)¶
Create a new
lockand initialize in
QgsReadWriteLockerclass is a convenience class that simplifies locking and unlocking QReadWriteLocks.
Locking and unlocking a QReadWriteLocks in complex functions and statements or in exception handling code is error-prone and difficult to debug.
QgsReadWriteLockercan be used in such situations to ensure that the state of the lock is always well-defined.
QgsReadWriteLockershould be created within a function where a QReadWriteLock needs to be locked. The lock may be locked when
QgsReadWriteLockeris created or when changeMode is called. You can unlock and relock the lock with unlock() and changeMode(). If locked, the lock will be unlocked when the
New in version 3.4.
lock (QReadWriteLock) –
changeMode(self, mode: QgsReadWriteLocker.Mode)¶
Change the mode of the lock to
mode. The lock will be unlocked and relocked as required.
mode (QgsReadWriteLocker.Mode) –
Unlocks the lock. Equivalent to doing
changeMode( QgsReadWriteLocker.Unlock );