DD::Image::ReadWriteLock Class Reference

Read/Write Lock for shared access. More...

Public Member Functions

bool readLock ()
 
bool tryReadLock ()
 Try the lock for reading, this only block writes.
 
bool writeLock ()
 Lock for writing, this blocks reads and all writes.
 
bool tryWriteLock ()
 Try the lock for writing, this blocks reads and all writes.
 
bool unlock ()
 

Protected Attributes

pthread_rwlock_t _lock
 my pthread rwlock that implements this
 

Detailed Description

Read/Write Lock for shared access.

A Read/Write lock that allows multiple readers to gain access to the lock, but only one writer at a time.

This lock is not recursive.

Member Function Documentation

bool DD::Image::ReadWriteLock::readLock ( )
inline

Acquire lock for reading, this only blocks writes not other reads.

Returns
true if successfully acquired the lock.
bool DD::Image::ReadWriteLock::unlock ( )
inline

Unlock an already acquired lock.

Returns
true if successfully unlocked the lock.


©2022 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk