osg::Barrier Class Reference
[Multithreading]

#include <OSGBarrier.h>

Inheritance diagram for osg::Barrier:

osg::PThreadBarrierBase osg::BarrierCommonBase osg::MPBase osg::MemoryObject

List of all members.

Public Types

typedef MPBarrierType Type

Public Member Functions

Enter


void enter (void)
void enter (UInt32 uiNumWaitFor)
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

Get


static Barrier * get (const Char8 *szName)
static Barrier * find (const Char8 *szName)
static Barrier * create (void)
static const MPBarrierType & getClassType (void)
Class Get


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

Protected Types

typedef PthreadBarrierBase Inherited

Protected Member Functions

Constructors


 Barrier (const Char8 *szName, UInt32 uiId)
Destructor


virtual ~Barrier (void)
Construction


bool init (void)
Destruction


void shutdown (void)
Set


void setNumWaitFor (UInt32 uiNumWaitFor)

Static Protected Member Functions

Construction


static Barrier * create (const Char8 *szName, UInt32 uiId)

Protected Attributes

UInt32 _uiBarrierId
volatile UInt32 _uiNumWaitFor
Class Specific


Char8 * _szName

Static Protected Attributes

static MPBarrierType _type

Private Member Functions

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

Friends

class MPFieldStore< Barrier >


Detailed Description

Definition at line 362 of file OSGBarrier.h.


Member Typedef Documentation

Definition at line 368 of file OSGBarrier.h.

Reimplemented from osg::PThreadBarrierBase.

Definition at line 394 of file OSGBarrier.h.


Constructor & Destructor Documentation

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

Definition at line 278 of file OSGBarrier.cpp.

Referenced by create().

00279                                        :
00280     Inherited(szName, uiId)
00281 {
00282 }

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

Definition at line 286 of file OSGBarrier.cpp.

References osg::ThreadManager::removeBarrier(), osg::PThreadBarrierBase::shutdown(), and osg::ThreadManager::the().

00287 {
00288     ThreadManager::the()->removeBarrier(this);
00289 
00290     shutdown();
00291 }

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


Member Function Documentation

Barrier * Barrier::get ( const Char8 *  szName  )  [static]

Definition at line 295 of file OSGBarrier.cpp.

References osg::ThreadManager::getBarrier(), and osg::ThreadManager::the().

Referenced by create(), and osg::DgramQueue::DgramQueue().

00296 {
00297     return ThreadManager::the()->getBarrier(szName, "OSGBarrier");
00298 }

Barrier * Barrier::find ( const Char8 *  szName  )  [static]

Definition at line 300 of file OSGBarrier.cpp.

References osg::ThreadManager::findBarrier(), and osg::ThreadManager::the().

00301 {
00302     return ThreadManager::the()->findBarrier(szName);
00303 }

Barrier * osg::Barrier::create ( void   )  [inline, static]

Definition at line 327 of file OSGBarrier.inl.

References get().

00329 {
00330 
00331     return Barrier::get(NULL);
00332 
00333 }

const MPBarrierType & osg::Barrier::getClassType ( void   )  [inline, static]

Definition at line 339 of file OSGBarrier.inl.

References _type.

Referenced by osg::ThreadManager::init().

00341 {
00342 
00343     return _type;
00344 
00345 }

void osg::Barrier::enter ( void   )  [inline]

Reimplemented from osg::PThreadBarrierBase.

Definition at line 357 of file OSGBarrier.inl.

References osg::PThreadBarrierBase::enter().

Referenced by osg::DgramQueue::get(), osg::DgramQueue::put(), and osg::DgramQueue::wait().

00359 {
00360 
00361     Inherited::enter();
00362 
00363 }

void osg::Barrier::enter ( UInt32  uiNumWaitFor  )  [inline]

Reimplemented from osg::PThreadBarrierBase.

Definition at line 369 of file OSGBarrier.inl.

References osg::PThreadBarrierBase::enter().

00371 {
00372 
00373     Inherited::enter(uiNumWaitFor);
00374 
00375 }

Barrier * Barrier::create ( const Char8 *  szName,
UInt32  uiId 
) [static, protected]

Definition at line 308 of file OSGBarrier.cpp.

References Barrier(), and osg::PThreadBarrierBase::init().

00310 {
00311     Barrier *returnValue = NULL;
00312 
00313     returnValue = new Barrier(szName, uiId);
00314 
00315     if(returnValue->init() == false)
00316     {
00317         delete returnValue;
00318         returnValue = NULL;
00319    }
00320 
00321     return returnValue;
00322 }

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

bool PThreadBarrierBase::init ( void   )  [protected, inherited]

Definition at line 105 of file OSGBarrier.cpp.

References osg::PThreadBarrierBase::_pLockOne, osg::PThreadBarrierBase::_pWakeupCondition, osg::PThreadBarrierBase::_uiCount, and osg::PThreadBarrierBase::_uiCurrentCond.

Referenced by create().

00106 {
00107     pthread_cond_init (&(_pWakeupCondition[0]), NULL);
00108     pthread_cond_init (&(_pWakeupCondition[1]), NULL);
00109     pthread_mutex_init(&(_pLockOne),            NULL);
00110 
00111     _uiCount       = 0;
00112     _uiCurrentCond = 0;
00113 
00114     return true;
00115 }

void PThreadBarrierBase::shutdown ( void   )  [protected, inherited]

Definition at line 119 of file OSGBarrier.cpp.

References osg::PThreadBarrierBase::_pLockOne, and osg::PThreadBarrierBase::_pWakeupCondition.

Referenced by ~Barrier().

00120 {
00121     pthread_cond_destroy (&(_pWakeupCondition[0]));
00122     pthread_cond_destroy (&(_pWakeupCondition[1]));
00123     pthread_mutex_destroy(&(_pLockOne));
00124 }

void osg::BarrierCommonBase::setNumWaitFor ( UInt32  uiNumWaitFor  )  [inline, protected, inherited]

Definition at line 83 of file OSGBarrier.inl.

References osg::BarrierCommonBase::_uiNumWaitFor.

00085 {
00086 
00087     _uiNumWaitFor = uiNumWaitFor;
00088 
00089 }

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 MPFieldStore< Barrier > [friend]

Definition at line 424 of file OSGBarrier.h.


Member Data Documentation

MPBarrierType Barrier::_type [static, protected]

Reimplemented from osg::MPBase.

Definition at line 396 of file OSGBarrier.h.

Referenced by getClassType().

Definition at line 86 of file OSGBarrier.h.

volatile UInt32 osg::BarrierCommonBase::_uiNumWaitFor [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:09 2008 for OpenSG by  doxygen 1.5.5