A counting semaphore implementation. More...
#include <acedia_util.hpp>
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. |
A counting semaphore implementation.
Definition at line 346 of file acedia_util.hpp.
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.
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.
n
resources are acquired; otherwise false Definition at line 279 of file acedia_util.cpp.