Libthreadar  1.0.1
 All Classes Namespaces Files Functions Macros
Public Member Functions | List of all members
libthreadar::barrier Class Reference

the class barrier allows several threads to synchronize between them More...

#include <barrier.hpp>

Public Member Functions

 barrier (unsigned int num)
 The constructor. More...
 
 ~barrier ()
 The destructor. More...
 
void wait ()
 suspend the calling thread waiting for other up to 'num' other thread to call wait too More...
 

Detailed Description

the class barrier allows several threads to synchronize between them

the number of thread to synchronize is given in the constructor argument 'num'. All thread calling the wait() method get locked until 'num' thread(s) have called this wait() method at which time they are all unlocked. The barrier object is then ready for a new cycle.

Note
The barrier shall not be destroyed if at least one thread is waiting (locked) on it

Definition at line 57 of file barrier.hpp.

Constructor & Destructor Documentation

libthreadar::barrier::barrier ( unsigned int  num)

The constructor.

Parameters
[in]numis the number of thread to synchronize
libthreadar::barrier::~barrier ( )

The destructor.

Note
A barrier object must not be destroyed if some thread are suspended calling wait() on it

Member Function Documentation

void libthreadar::barrier::wait ( )

suspend the calling thread waiting for other up to 'num' other thread to call wait too

Note
A thread is suspended up to the time a total amount of 'num' threads (as given to the barrier constructor) have also called wait(). Then all suspended thread are resumed.

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