Implements a semaphore.
More...
#include "nn/nlib/threading/Semaphore.h"
Implements a semaphore.
- Description
- Implementation in Win32.
- Wraps the Win32 API.
- Implementation in Linux/Cygwin
- Wraps POSIX semaphore.
- Implementation in CTR.
- Wraps
nn::os::Semaphore
.
Definition at line 12 of file Semaphore.h.
nn::nlib::threading::Semaphore::Acquire |
( |
| ) |
|
|
inlinenoexcept |
Locks one semaphore.
- Return values
-
0 | Lock was successful. |
EINVAL | Invalid semaphore. |
Definition at line 27 of file Semaphore.h.
nn::nlib::threading::Semaphore::Init |
( |
int |
initialCount | ) |
|
|
inlinenoexcept |
Initializes the semaphore.
- Parameters
-
[in] | initialCount | The initial value of the semaphore. |
- Return values
-
0 | Initialization was successful. |
EINVAL | Indicates that initialCount is too large. |
Definition at line 18 of file Semaphore.h.
nn::nlib::threading::Semaphore::Release |
( |
int * |
previousCount | ) |
|
|
inlinenoexcept |
Releases one semaphore.
- Parameters
-
[out] | previousCount | The previous semaphore value is stored if any value other than NULL is specified. |
- Return values
-
0 | Success. |
EINVAL | Invalid semaphore. |
EOVERFLOW | The semaphore is already at the maximum count. |
Definition at line 21 of file Semaphore.h.
nn::nlib::threading::Semaphore::Release |
( |
int |
releaseCount, |
|
|
int * |
previousCount |
|
) |
| |
|
inlinenoexcept |
Releases multiple semaphores. May not be executed atomically.
- Parameters
-
[in] | releaseCount | Count number of semaphores to release. |
[out] | previousCount | The previous semaphore value is stored if any value other than NULL is specified. |
- Return values
-
0 | Success. |
EINVAL | Invalid semaphore. |
EOVERFLOW | Semaphores have exceeded the maximum count. The post-execution semaphore count is undefined. |
ENOTSUP | Indicates that the platform does not support multiple releases. |
Definition at line 24 of file Semaphore.h.
nn::nlib::threading::Semaphore::TryAcquire |
( |
| ) |
|
|
inlinenoexcept |
Tries to lock a semaphore.
- Return values
-
0 | Lock was successful. |
EAGAIN | Lock was unsuccessful. |
Definition at line 28 of file Semaphore.h.
Locks one semaphore with timeout.
- Parameters
-
[in] | timeout | Specifies the timeout. |
- Return values
-
0 | Lock was successful. |
EINVAL | Invalid semaphore. |
ETIMEDOUT | Indicates a timeout. |
Definition at line 31 of file Semaphore.h.
The documentation for this class was generated from the following files: