fesa-core
4.2.0
|
This class is used to automatically lock and unlock a read-write lock for writing. The constructor acquires a read-lock. The destructor releases the lock if it has not been explicitly unlocked. This ensures the read-write lock is returned to its previous state when a WriteLock object leaves scope. The read-write lock can also be unlocked explicitly, by calling the unlock() method. More...
#include <WriteLock.h>
Inherits noncopyable.
Public Member Functions | |
WriteLock (RWLock &lock) | |
Lock the associated read-write lock for writing if the current thread holds no locks. If the thread already holds a write lock no action is required. Does not allow a write lock if a read lock is already held by the thread. | |
~WriteLock () | |
Unlocks the associated read-write lock if it has been acquired. | |
void | unlock () |
Unlocks the associated read-write lock if it has been acquired. | |
This class is used to automatically lock and unlock a read-write lock for writing. The constructor acquires a read-lock. The destructor releases the lock if it has not been explicitly unlocked. This ensures the read-write lock is returned to its previous state when a WriteLock object leaves scope. The read-write lock can also be unlocked explicitly, by calling the unlock() method.