acedia::util::Semaphore Class Reference

A counting semaphore implementation. More...

#include <acedia_util.hpp>

List of all members.

Public Member Functions

void release (boost::int32_t n=1)
 Release n resources.
void acquire (boost::int32_t n=1)
 Acquire n resources.
bool tryAcquire (boost::int32_t n=1)
 Try to acquire n resrouces.
bool tryAcquire (boost::int32_t n, boost::uint16_t msTimeout)
 Try to acquire n resrouces.
int available () const throw ()
 Get the current available resources.

Detailed Description

A counting semaphore implementation.

Definition at line 346 of file acedia_util.hpp.


Member Function Documentation

void acedia::util::Semaphore::acquire ( boost::int32_t  n = 1  ) 

Acquire n resources.

This method blocks if there are not enough resources available.

Definition at line 271 of file acedia_util.cpp.

bool acedia::util::Semaphore::tryAcquire ( boost::int32_t  n,
boost::uint16_t  msTimeout 
)

Try to acquire n resrouces.

This method blocks if there are not enough resources available but waits at most msTimeout milliseconds.

Returns:
true if n resources are acquired; otherwise false

Definition at line 291 of file acedia_util.cpp.

bool acedia::util::Semaphore::tryAcquire ( boost::int32_t  n = 1  ) 

Try to acquire n resrouces.

This method does not block and returns always immediately.

Returns:
true if n resources are acquired; otherwise false

Definition at line 279 of file acedia_util.cpp.


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

Generated by  doxygen 1.6.2