OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::Barrier Class Reference

A barrier is a synchronization mechanism where multiple threads wait until all of them have reached the barrier sync point before continuing. More...

#include <OgreBarrier.h>

Public Member Functions

 Barrier (size_t threadCount)
 
 ~Barrier ()
 
void sync (void)
 When calling this function, it will block until all N threads reach this point; where N is the thread count passed to the Barrier's constructor. More...
 

Private Member Functions

 OGRE_ALIGNED_DECL (volatile LONG, mLockCount, 4)
 

Private Attributes

size_t mIndex
 
size_t mNumThreads
 
HANDLE mSemaphores [2]
 

Detailed Description

A barrier is a synchronization mechanism where multiple threads wait until all of them have reached the barrier sync point before continuing.

A fixed number of threads must be provided on initialization.

Remarks
On Windows, Synchronization Barriers weren't introduced until Windows 8 (!?!?!? No comments...) Therefore, we emulate them using two Semaphores and (for performance reasons)
Author
Matias N. Goldberg

Definition at line 62 of file OgreBarrier.h.

Constructor & Destructor Documentation

Ogre::Barrier::Barrier ( size_t  threadCount)
Ogre::Barrier::~Barrier ( )

Member Function Documentation

Ogre::Barrier::OGRE_ALIGNED_DECL ( volatile LONG  ,
mLockCount  ,
 
)
private
void Ogre::Barrier::sync ( void  )

When calling this function, it will block until all N threads reach this point; where N is the thread count passed to the Barrier's constructor.

Member Data Documentation

size_t Ogre::Barrier::mIndex
private

Definition at line 66 of file OgreBarrier.h.

size_t Ogre::Barrier::mNumThreads
private

Definition at line 65 of file OgreBarrier.h.

HANDLE Ogre::Barrier::mSemaphores[2]
private

Definition at line 68 of file OgreBarrier.h.


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