Qore Programming Language Reference Manual 0.8.12.8
|constructor (RWLock rwl)|
|Creates the AutoReadLock object based on the RWLock argument passed and immediately calls RWLock::readLock() More...|
|Throws an exception; objects of this class cannot be copied. More...|
|Calls RWLock::readUnlock() on the saved RWLock and destroys the AutoReadLock object. More...|
A helper class for the RWLock class for exception-safe read lock handling.
AutoReadLock objects, when used along with a RWLock object, allow Qore programmers to safely acquire and release a read lock, even if exceptions are thrown or return statements are executed in the block where the AutoReadLock object is created.
AutoReadLock objects are helper objects that acquire a read lock for the lifetime of the AutoReadLock object. For this reason, it is only appropriate to assign an AutoReadLock object to a local variable, so when the local variable goes out of scope, the AutoReadLock object will be deleted and the read lock will be automatically released.
Creates the AutoReadLock object based on the RWLock argument passed. The AutoReadLock object immediately calls RWLock::readLock() on the RWLock object passed, and saves it so it can be released when the AutoReadLock object is destroyed.
|THREAD-DEADLOCK||A deadlock was detected while trying to acquire the lock|
|LOCK-ERROR||RWLock::readLock() called while already holding the write lock, object deleted in another thread, etc.|
Throws an exception; objects of this class cannot be copied.
|AUTOREADLOCK-COPY-ERROR||objects of this class cannot be copied|