osg::PThreadLockBase Class Reference
[Multithreading]

#include <OSGLock.h>

Inheritance diagram for osg::PThreadLockBase:

osg::LockCommonBase osg::MPBase osg::MemoryObject osg::Lock

List of all members.

Class Specific



Char8 * _szName
static MPType _type

Public Member Functions

Get


virtual MPType & getType (void)
virtual const MPType & getType (void) const
UInt32 getTypeId (void)
const Char8 * getCName (void) const
Reference Counting


void addRef (void)
void subRef (void)
Int32 getRefCount (void)

Static Public Member Functions

Class Get


static const MPType & getStaticType (void)
static UInt32 getStaticTypeId (void)

Protected Types

typedef LockCommonBase Inherited

Protected Member Functions

Constructors


 PThreadLockBase (void)
 PThreadLockBase (const Char8 *szName, UInt32 uiId)
Destructor


virtual ~PThreadLockBase (void)
Construction


bool init (void)
Destruction


void shutdown (void)
Lock


void aquire (void)
void release (void)
bool request (void)

Protected Attributes

UInt32 _uiLockId

Private Member Functions

 PThreadLockBase (const PThreadLockBase &source)
 prohibit default function (move to 'public' if needed)
void operator= (const PThreadLockBase &source)
 prohibit default function (move to 'public' if needed)

Private Attributes

pthread_mutex_t _pLowLevelLock

Friends

class LockPool


Detailed Description

Definition at line 131 of file OSGLock.h.


Member Typedef Documentation

Reimplemented from osg::LockCommonBase.

Reimplemented in osg::Lock.

Definition at line 141 of file OSGLock.h.


Constructor & Destructor Documentation

PThreadLockBase::PThreadLockBase ( void   )  [protected]

Definition at line 94 of file OSGLock.cpp.

00094                                     :
00095      Inherited    (),
00096     _pLowLevelLock()
00097 {
00098 }

PThreadLockBase::PThreadLockBase ( const Char8 *  szName,
UInt32  uiId 
) [protected]

Definition at line 100 of file OSGLock.cpp.

00101                                                        :
00102      Inherited    (szName, uiId),
00103     _pLowLevelLock()
00104 {
00105 }

PThreadLockBase::~PThreadLockBase ( void   )  [protected, virtual]

Definition at line 109 of file OSGLock.cpp.

00110 {
00111 }

osg::PThreadLockBase::PThreadLockBase ( const PThreadLockBase &  source  )  [private]


Member Function Documentation

bool PThreadLockBase::init ( void   )  [protected]

Definition at line 115 of file OSGLock.cpp.

References _pLowLevelLock.

Referenced by osg::Lock::create(), and osg::LockPool::init().

00116 {
00117     pthread_mutexattr_t lockAttr;
00118 
00119     pthread_mutexattr_init(&lockAttr);
00120 
00121     pthread_mutexattr_settype(&lockAttr, PTHREAD_MUTEX_RECURSIVE);
00122         
00123     pthread_mutex_init(&(_pLowLevelLock), &lockAttr);
00124 
00125     return true;
00126 }

void PThreadLockBase::shutdown ( void   )  [protected]

Definition at line 130 of file OSGLock.cpp.

References _pLowLevelLock.

Referenced by osg::LockPool::shutdown(), and osg::Lock::~Lock().

00131 {
00132     pthread_mutex_destroy(&(_pLowLevelLock));
00133 }

void PThreadLockBase::aquire ( void   )  [protected]

Reimplemented in osg::Lock.

Definition at line 137 of file OSGLock.cpp.

References _pLowLevelLock.

Referenced by osg::Lock::aquire().

00138 {
00139     pthread_mutex_lock(&(_pLowLevelLock));
00140 }

void PThreadLockBase::release ( void   )  [protected]

Reimplemented in osg::Lock.

Definition at line 142 of file OSGLock.cpp.

References _pLowLevelLock.

Referenced by osg::Lock::release().

00143 {
00144     pthread_mutex_unlock(&(_pLowLevelLock));
00145 }

bool PThreadLockBase::request ( void   )  [protected]

Reimplemented in osg::Lock.

Definition at line 147 of file OSGLock.cpp.

References _pLowLevelLock.

Referenced by osg::Lock::request().

00148 {
00149     return (pthread_mutex_trylock(&(_pLowLevelLock)) != EBUSY);
00150 }

void osg::PThreadLockBase::operator= ( const PThreadLockBase &  source  )  [private]

const MPType & MPBase::getStaticType ( void   )  [static, inherited]

Definition at line 253 of file OSGMPBase.cpp.

References osg::MPBase::_type.

00254 {
00255     return _type;
00256 }

UInt32 MPBase::getStaticTypeId ( void   )  [static, inherited]

Definition at line 259 of file OSGMPBase.cpp.

00260 {
00261     return 0;
00262 }

MPType & MPBase::getType ( void   )  [virtual, inherited]

Definition at line 265 of file OSGMPBase.cpp.

References osg::MPBase::_type.

Referenced by osg::MPBase::getTypeId().

00266 {
00267     return _type;
00268 }

const MPType & MPBase::getType ( void   )  const [virtual, inherited]

Definition at line 271 of file OSGMPBase.cpp.

References osg::MPBase::_type.

00272 {
00273     return _type;
00274 }

UInt32 MPBase::getTypeId ( void   )  [inherited]

Definition at line 277 of file OSGMPBase.cpp.

References osg::TypeBase::getId(), and osg::MPBase::getType().

00278 {
00279     return getType().getId();
00280 }

const Char8 * MPBase::getCName ( void   )  const [inherited]

Definition at line 283 of file OSGMPBase.cpp.

References osg::MPBase::_szName.

00284 {
00285     return _szName;
00286 }

void MemoryObject::addRef ( void   )  [inherited]

void MemoryObject::subRef ( void   )  [inherited]

Definition at line 69 of file OSGMemoryObject.cpp.

References osg::MemoryObject::_refCount.

00070 {
00071     _refCount--;
00072 
00073     if(_refCount <= 0)
00074         delete this;
00075 }

Int32 MemoryObject::getRefCount ( void   )  [inherited]

Definition at line 77 of file OSGMemoryObject.cpp.

References osg::MemoryObject::_refCount.

00078 {
00079     return _refCount;
00080 }


Friends And Related Function Documentation

friend class LockPool [friend]

Reimplemented in osg::Lock.

Definition at line 185 of file OSGLock.h.


Member Data Documentation

pthread_mutex_t osg::PThreadLockBase::_pLowLevelLock [private]

Definition at line 187 of file OSGLock.h.

Referenced by aquire(), init(), release(), request(), and shutdown().

UInt32 osg::LockCommonBase::_uiLockId [protected, inherited]

Definition at line 92 of file OSGLock.h.

MPType MPBase::_type [static, protected, inherited]

Char8* osg::MPBase::_szName [protected, inherited]


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

Generated on Mon Mar 17 12:03:14 2008 for OpenSG by  doxygen 1.5.5