Thread synchronisation helper.
More...
VTM_API int vtm_latch_init |
( |
struct vtm_latch * |
latch, |
|
|
unsigned int |
count |
|
) |
| |
Initializes a new latch.
- Parameters
-
latch | pointer to the latch, can be on stack or heap |
count | initial counter of the latch |
- Returns
- VTM_OK when the latch was successfully initialized
-
VTM_ERROR when the latch could not be initialized
VTM_API void vtm_latch_release |
( |
struct vtm_latch * |
latch | ) |
|
Releases all resources of the given latch
- Parameters
-
latch | the latch which should be released |
VTM_API void vtm_latch_count |
( |
struct vtm_latch * |
latch | ) |
|
Decrements the latch counter by one.
If the counter reaches zero, all threads waiting in vtm_latch_await() are released and continue their execution.
- Parameters
-
VTM_API void vtm_latch_await |
( |
struct vtm_latch * |
latch | ) |
|
Waits until the latch counter reaches zero.
- Parameters
-