![]() |
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 |
destructor
|
virtual |
destroy the lock
Reimplemented in DtIpcRdWrLock__rti__.
|
virtual |
initialize the locking mechanism
Reimplemented in DtIpcRdWrLock__rti__.
|
protected |
assignment operator
|
virtual |
lock the protected resource for reading. Return 0 if lock acquired.
|
virtual |
unlock the read-lock on the protected resource.
Return 0 if lock released.
|
virtual |
lock the protected resource for writing. Return 0 if lock acquired.
|
virtual |
unlock the write-lock on the protected resource.
Return 0 if lock released.
|
protected |
|
protected |
|
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.
|
protected |