STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::semaphore Class Reference

Detailed Description

Definition at line 23 of file semaphore.h.

+ Inheritance diagram for stxxl::semaphore:
+ Collaboration diagram for stxxl::semaphore:

Public Member Functions

 semaphore (int init_value=1)
 construct semaphore More...
 
int decrement ()
 function does NOT block but simply decrements the semaphore should not be used instead of down – only for programs where multiple threads must up on a semaphore before another thread can go down, i.e., allows programmer to set the semaphore to a negative value prior to using it for synchronization. More...
 
int operator++ (int)
 function increments the semaphore and signals any threads that are blocked waiting a change in the semaphore More...
 
int operator-- (int)
 function decrements the semaphore and blocks if the semaphore is <= 0 until another thread signals a change More...
 

Private Attributes

condition_variable m_cond
 condition variable More...
 
mutex m_mutex
 mutex for condition variable More...
 
int v
 value of the semaphore More...
 

Additional Inherited Members

- Private Member Functions inherited from stxxl::noncopyable
 noncopyable ()
 

Constructor & Destructor Documentation

stxxl::semaphore::semaphore ( int  init_value = 1)
inline

construct semaphore

Definition at line 36 of file semaphore.h.

Member Function Documentation

int stxxl::semaphore::decrement ( )
inline

function does NOT block but simply decrements the semaphore should not be used instead of down – only for programs where multiple threads must up on a semaphore before another thread can go down, i.e., allows programmer to set the semaphore to a negative value prior to using it for synchronization.

Definition at line 64 of file semaphore.h.

int stxxl::semaphore::operator++ ( int  )
inline

function increments the semaphore and signals any threads that are blocked waiting a change in the semaphore

Definition at line 41 of file semaphore.h.

References stxxl::scoped_mutex_lock::unlock().

int stxxl::semaphore::operator-- ( int  )
inline

function decrements the semaphore and blocks if the semaphore is <= 0 until another thread signals a change

Definition at line 51 of file semaphore.h.

Member Data Documentation

condition_variable stxxl::semaphore::m_cond
private

condition variable

Definition at line 32 of file semaphore.h.

mutex stxxl::semaphore::m_mutex
private

mutex for condition variable

Definition at line 29 of file semaphore.h.

int stxxl::semaphore::v
private

value of the semaphore

Definition at line 26 of file semaphore.h.


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