|
Discrete Dipole Approximation Project
1.0
Plugin based Discrete Dipole Approximation (DDA) software package.
|
A Semaphore provides a more advanced synchronization then a Mutex like a Mutex, a Semaphore can be aquired and released by a thread however unlike a Mutex, a Semaphore may be aquired by several threads the number of threads that can hold a Semaphore is detrimed by its internal counter. This counter is declarmented when aquired and inclimented when released. The Semaphore may be aquired by a thread as long as the counter is more than 0.
#include "thread.h"
Public Member Functions | |
| Semaphore (unsigned int value) | |
Constructs a new Semaphore object and sets the internal counter to value this indicates the maximum number of threads that can aquire the Semaphore a once. More... | |
| ~Semaphore () | |
| Destroys the Semaphore object. | |
| bool | Post (unsigned int count=1) |
| Release the Semaphore. More... | |
| bool | TryWait () |
| Atempts to aquire the Semaphore and returns immediately. More... | |
| bool | Wait (unsigned long timeout, bool execpt=true) |
| Aquires the Semaphore object when the internal counter is more than 0. More... | |
|
inline |
| [in] | value | Number of thread that can aquire at once |
|
inline |
This will result in the internal counter being increassed by count.
true on success, false on error. | [in] | count | Number of times to release. |
|
inline |
This function will fail if the Semaphore isn't free.
true if aquired, false otherwise.
|
inline |
If the Semaphore isn't free, this call will block until the Semaphore is free of timeout has been exceeded.
true if aquired, false otherwise. | TimeoutException | Raised in execpt is true and timeout has been exceeded. |
1.8.5
|
Project Web Hosted by