OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::WaitableEvent Class Reference

A WaitableEvent is useful in the scenario of a singler consumer, multiple producers The consumer will wait until any of the producers wake it up to consume the work. More...

#include <OgreWaitableEvent.h>

Public Member Functions

 WaitableEvent ()
 
 ~WaitableEvent ()
 
bool wait ()
 Waits until another thread calls wake(). More...
 
void wake ()
 Tells the other thread to wake up from wait(). More...
 

Detailed Description

A WaitableEvent is useful in the scenario of a singler consumer, multiple producers The consumer will wait until any of the producers wake it up to consume the work.

It is not recommended for a multiple consumers scenario; as you would need one WaitableEvent per consumer, which would be expensive and won't scale.
On Windows it uses an auto-reset event. On other OSes it uses a condition variable.

Constructor & Destructor Documentation

◆ WaitableEvent()

Ogre::WaitableEvent::WaitableEvent ( )

◆ ~WaitableEvent()

Ogre::WaitableEvent::~WaitableEvent ( )

Member Function Documentation

◆ wait()

bool Ogre::WaitableEvent::wait ( )

Waits until another thread calls wake().

If wake has already been called, we'll return immediately, and we'll go to sleep if you call wait again (unless wake was called again in the middle, of course). If wake has never been called yet, we go to sleep. On error returns false, true if everything's ok.

◆ wake()

void Ogre::WaitableEvent::wake ( )

Tells the other thread to wake up from wait().

Calling wake multiple times without any wait in the middle is the same as calling it just once.


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