![]() |
MAK RTIspy API Documentation for HLA 1.3
|
Platform independent read-lock / write-lock. More...
Inheritance diagram for DtRdWrLock__rti__:
Collaboration diagram for DtRdWrLock__rti__:Public Member Functions | |
| DtRdWrLock__rti__ () | |
| default constructor | |
| virtual | ~DtRdWrLock__rti__ () |
| destructor | |
| virtual void | init () |
| initialize the locking mechanism | |
| virtual void | destroy () |
| destroy the lock | |
| virtual int | wrLock () |
| lock the protected resource for writing. Return 0 if lock acquired. | |
| virtual int | rdLock () |
| lock the protected resource for reading. Return 0 if lock acquired. | |
| virtual int | wrUnlock () |
| unlock the write-lock on the protected resource. | |
| virtual int | rdUnlock () |
| unlock the read-lock on the protected resource. | |
Protected Member Functions | |
| DtRdWrLock__rti__ (const DtRdWrLock__rti__ &orig) | |
| copy constructor | |
| const DtRdWrLock__rti__ & | operator= (const DtRdWrLock__rti__ &orig) |
| assignment operator | |
Protected Attributes | |
| volatile long | readers |
| The Win32 implementation uses two counters and the Interlocked Variable Access facility to create a lightweight locking mechanism. | |
| volatile long | writers |
| pthread_rwlock_t | myPtLock |
| pthread_rwlock_t * | myLock |
Platform independent read-lock / write-lock.
Instances of DtRdWrLock are used to provide a platform independent read-lock / write-lock mechanism for use by threads of the same process. Do not use this class to implement inter-process comm- unication between threads of different processes.
| DtRdWrLock__rti__::DtRdWrLock__rti__ | ( | ) |
default constructor
|
protected |
copy constructor
|
virtual |
|
virtual |
|
protected |
assignment operator
|
virtual |
lock the protected resource for reading. Return 0 if lock acquired.
References myLock, readers, and writers.
Referenced by DtSmSubscribableMessageQueue__rti__::lockForRead().
|
virtual |
unlock the read-lock on the protected resource.
Return 0 if lock released.
References myLock, and readers.
Referenced by DtSmSubscribableMessageQueue__rti__::unlockForRead().
|
virtual |
lock the protected resource for writing. Return 0 if lock acquired.
References myLock, readers, and writers.
Referenced by DtSmSubscribableMessageQueue__rti__::lockForWrite().
|
virtual |
unlock the write-lock on the protected resource.
Return 0 if lock released.
References myLock, and writers.
Referenced by DtSmSubscribableMessageQueue__rti__::unlockForWrite().
|
protected |
|
protected |
Referenced by init().
|
protected |
The Win32 implementation uses two counters and the Interlocked Variable Access facility to create a lightweight locking mechanism.
("Lightweight" because it doesn't use semaphores, which are slower). However since the counters are limited in scope to the process that creates them (and any threads that inherit from that process) this mechanism cannot be used for inter-process locking, only intra-process thread locking. In order to avoid having two different ctors for Windows and *nix implementations these counters are present in both implementations and initialized in the ctor init-list, however they are unused in *nix builds This implementation is first-come, first-served which favors writers over readers.
Referenced by DtIpcRdWrLock__rti__::destroy(), destroy(), init(), rdLock(), rdUnlock(), wrLock(), DtIpcRdWrLock__rti__::~DtIpcRdWrLock__rti__(), and ~DtRdWrLock__rti__().
|
protected |
Referenced by destroy(), init(), rdLock(), wrLock(), wrUnlock(), and ~DtRdWrLock__rti__().