Class: QgsReadWriteLocker¶
The QgsReadWriteLocker class 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. QgsReadWriteLocker can be used in such situations to
ensure that the state of the lock is always well-defined.
QgsReadWriteLocker should be created within a function where
a QReadWriteLock needs to be locked. The lock may be locked when
QgsReadWriteLocker is 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
QgsReadWriteLocker is destroyed.
Added in version 3.4.
Methods
Change the mode of the lock to mode.  | 
|
Unlocks the lock.  | 
Attributes
- class qgis.core.QgsReadWriteLocker[source]¶
 Bases:
object- __init__(lock: QReadWriteLock, mode: QgsReadWriteLocker.Mode)
 Create a new QgsReadWriteLocker for
lockand initialize inmode.- Parameters:
 lock (QReadWriteLock)
mode (QgsReadWriteLocker.Mode)
- __init__(a0: QgsReadWriteLocker)
 - Parameters:
 a0 (QgsReadWriteLocker)
- class Mode¶
 Bases:
int
- Read = 0¶
 
- Unlocked = 2¶
 
- Write = 1¶
 
- changeMode(self, mode: QgsReadWriteLocker.Mode)[source]¶
 Change the mode of the lock to
mode. The lock will be unlocked and relocked as required.- Parameters:
 mode (QgsReadWriteLocker.Mode)