Neo  0.5.0
Developer Documentation
Neo::Semaphore Class Referenceabstract

The MSemaphore class implements a semaphore mechanism based on SDL for use with MThread. More...

#include <Thread.h>

Public Member Functions

 Semaphore ()
 
 ~Semaphore ()
 
virtual bool Init (int num)=0
 Initializes the semaphore. More...
 
virtual bool WaitAndLock ()=0
 
virtual bool Unlock ()=0
 
virtual SemaphoregetNew ()=0
 Creates a new semaphore object. More...
 

Static Public Member Functions

static bool WaitAndLock (Semaphore *)
 Locks the semaphore given as parameter and waits if it's already locked. More...
 
static bool Unlock (Semaphore *)
 

Detailed Description

The MSemaphore class implements a semaphore mechanism based on SDL for use with MThread.

Bug:
Should be in its own file!
See also
MSemaphoreWaitAndLock
MSemaphoreUnlock

Constructor & Destructor Documentation

Neo::Semaphore::Semaphore ( )
inline
Neo::Semaphore::~Semaphore ( )
inline

Member Function Documentation

virtual Semaphore* Neo::Semaphore::getNew ( )
pure virtual

Creates a new semaphore object.

Returns
The new object.
virtual bool Neo::Semaphore::Init ( int  num)
pure virtual

Initializes the semaphore.

Parameters
numNumber of MSemaphoreWaitAndLock without unlocking will pass until the requesting thread will block. Usually set to 1.
Returns
Returns true on success and false on failure.
static bool Neo::Semaphore::Unlock ( Semaphore )
static
virtual bool Neo::Semaphore::Unlock ( )
pure virtual
static bool Neo::Semaphore::WaitAndLock ( Semaphore )
static

Locks the semaphore given as parameter and waits if it's already locked.

Parameters
semThe pointer to a MSemaphore which shall be locked/waited for.
Returns
Returns true on success and false on failure.
virtual bool Neo::Semaphore::WaitAndLock ( )
pure virtual

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