synthclone  0.3.0
synthclone::Semaphore Class Reference

A portable semaphore object, optimally including a realtime-safe 'post' operation. More...

#include <synthclone/semaphore.h>

Inheritance diagram for synthclone::Semaphore:
Collaboration diagram for synthclone::Semaphore:

Public Member Functions

 Semaphore (QObject *parent=0)
 Constructs a new Semaphore object. More...
 
 ~Semaphore ()
 Destroys a Semaphore object. More...
 
void post ()
 Increments the semaphore. More...
 
void wait ()
 Decrements the semaphore if the semaphore's value is greater than zero; otherwise, the thread will wait until another thread performs a 'post' operation on the semaphore. More...
 

Detailed Description

A portable semaphore object, optimally including a realtime-safe 'post' operation.

Constructor & Destructor Documentation

synthclone::Semaphore::Semaphore ( QObject *  parent = 0)
explicit

Constructs a new Semaphore object.

Parameters
parentThe parent object of the semaphore.
synthclone::Semaphore::~Semaphore ( )

Destroys a Semaphore object.

Member Function Documentation

void synthclone::Semaphore::post ( )

Increments the semaphore.

If there is one or more threads waiting on the semaphore, then a thread will be woken up.

Note
This operation is realtime-safe on UNIX, and probably realtime-safe on Mac. It's unknown whether the operation is realtime-safe on Windows.
void synthclone::Semaphore::wait ( )

Decrements the semaphore if the semaphore's value is greater than zero; otherwise, the thread will wait until another thread performs a 'post' operation on the semaphore.


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