MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DtRdWrLock__rti__ Class Reference

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

Detailed Description

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.

Constructor & Destructor Documentation

DtRdWrLock__rti__::DtRdWrLock__rti__ ( )

default constructor

DtRdWrLock__rti__::DtRdWrLock__rti__ ( const DtRdWrLock__rti__ orig)
protected

copy constructor

virtual DtRdWrLock__rti__::~DtRdWrLock__rti__ ( )
virtual

destructor

Member Function Documentation

virtual void DtRdWrLock__rti__::destroy ( )
virtual

destroy the lock

Reimplemented in DtIpcRdWrLock__rti__.

virtual void DtRdWrLock__rti__::init ( )
virtual

initialize the locking mechanism

Reimplemented in DtIpcRdWrLock__rti__.

const DtRdWrLock__rti__& DtRdWrLock__rti__::operator= ( const DtRdWrLock__rti__ orig)
protected

assignment operator

virtual int DtRdWrLock__rti__::rdLock ( )
virtual

lock the protected resource for reading. Return 0 if lock acquired.

virtual int DtRdWrLock__rti__::rdUnlock ( )
virtual

unlock the read-lock on the protected resource.

Return 0 if lock released.

virtual int DtRdWrLock__rti__::wrLock ( )
virtual

lock the protected resource for writing. Return 0 if lock acquired.

virtual int DtRdWrLock__rti__::wrUnlock ( )
virtual

unlock the write-lock on the protected resource.

Return 0 if lock released.

Member Data Documentation

pthread_rwlock_t* DtRdWrLock__rti__::myLock
protected
pthread_rwlock_t DtRdWrLock__rti__::myPtLock
protected
volatile long DtRdWrLock__rti__::readers
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.

volatile long DtRdWrLock__rti__::writers
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)