|
Veritable Lasagna
An Allocator & Data Structure Library for C.
|
#include <windows.h>
Include dependency graph for vl_semaphore_win32.c:Macros | |
| #define | WIN32_LEAN_AND_MEAN |
Functions | |
| vl_semaphore | vlSemaphoreNew (vl_uint_t initialCount) |
| Creates a new semaphore with the specified initial count. | |
| void | vlSemaphoreDelete (vl_semaphore sem) |
| Deletes a semaphore handle and releases associated resources. | |
| vl_bool_t | vlSemaphoreWait (vl_semaphore sem, vl_uint_t timeoutMs) |
| Decrements (acquires) the semaphore count. | |
| void | vlSemaphorePost (vl_semaphore sem) |
| Increments (releases) the semaphore count. | |
| vl_bool_t | vlSemaphoreTryWait (vl_semaphore sem) |
| Attempts to decrement (acquire) the semaphore without blocking. | |
| vl_uint_t | vlSemaphoreGetCount (vl_semaphore sem) |
| Gets the current semaphore count. | |
| #define WIN32_LEAN_AND_MEAN |
| void vlSemaphoreDelete | ( | vl_semaphore | sem | ) |
Deletes a semaphore handle and releases associated resources.
NULL results in undefined behavior (will attempt to destroy a null pointer).NULL. Deleting a semaphore that still has threads waiting on it. Double deletion.| sem | Semaphore handle to delete |
| vl_uint_t vlSemaphoreGetCount | ( | vl_semaphore | sem | ) |
Gets the current semaphore count.
sem must not be NULL.NULL.| sem | Semaphore handle |
| vl_semaphore vlSemaphoreNew | ( | vl_uint_t | initialCount | ) |
Creates a new semaphore with the specified initial count.
vl_semaphore handle and is responsible for calling vlSemaphoreDelete.vlSemaphoreDelete.VL_SEMAPHORE_NULL if the semaphore could not be created.VL_SEMAPHORE_NULL if heap allocation fails or platform-specific initialization fails.NULL on failure.| initialCount | Initial number of available resources |
| void vlSemaphorePost | ( | vl_semaphore | sem | ) |
Increments (releases) the semaphore count.
If threads are waiting, one will be unblocked.
sem must not be NULL.NULL.| sem | Semaphore handle |
| vl_bool_t vlSemaphoreTryWait | ( | vl_semaphore | sem | ) |
Attempts to decrement (acquire) the semaphore without blocking.
sem must not be NULL.VL_FALSE if the count is zero.NULL.VL_TRUE if the semaphore was successfully acquired, VL_FALSE otherwise.| sem | Semaphore handle |
Decrements (acquires) the semaphore count.
If the count is zero, blocks until either:
sem must not be NULL.VL_FALSE if the timeout expires before the semaphore is acquired.NULL.VL_TRUE if the semaphore was successfully acquired, VL_FALSE on timeout or error.| sem | Semaphore handle |
| timeoutMs | Maximum time to wait in milliseconds. Note: 0 results in an immediate return if the semaphore is not available. |