|
AGX Dynamics 2.42.3.1
|
ReaderWriterLock provides shared access for readers and exclusive access for writers. More...
#include <ThreadSynchronization.h>
Public Member Functions | |
| ReaderWriterLock () | |
| Constructor. | |
| ReaderWriterLock (const ReaderWriterLock &)=delete | |
| void | lock () |
| Acquire exclusive access. | |
| void | lock_shared () |
| Acquire the shared lock. | |
| ReaderWriterLock & | operator= (const ReaderWriterLock &)=delete |
| void | unlock () |
| Relese the exclusive access. | |
| void | unlock_shared () |
| Releases the shared access. | |
ReaderWriterLock provides shared access for readers and exclusive access for writers.
A thread is not allowed to upgrade or downgrade their lock type. For example, if a shared access is taken via lock_shared, it must then be released via unlock_shared before exclusive access can be requested.
If c++17 is available, std::shared_mutex is recommended instead of this class.
Definition at line 154 of file ThreadSynchronization.h.
| agx::ReaderWriterLock::ReaderWriterLock | ( | ) |
Constructor.
|
delete |
| void agx::ReaderWriterLock::lock | ( | ) |
Acquire exclusive access.
| void agx::ReaderWriterLock::lock_shared | ( | ) |
Acquire the shared lock.
Multiple threads can have shared access at the same time. For example used by multiple readers.
|
delete |
| void agx::ReaderWriterLock::unlock | ( | ) |
Relese the exclusive access.
| void agx::ReaderWriterLock::unlock_shared | ( | ) |
Releases the shared access.