BOOL osReleaseSemaphore( HANDLE Handle, INDEX ReleaseCount, INDEX *PrevCount );
The handle of the semaphore object to be released.
The amount by which the semaphore's current counter will be incremented.
A pointer to a variable that receives the value of the semaphore counter as it was prior to this release operation.
Returns TRUE on success or FALSE on failure. To retrieve extended error information, call the osGetLastError function.
This function releases the specified semaphore object, incrementing its internal counter.
Semaphores are synchronization primitives used to manage access to critical sections. A code segment protected by a semaphore is restricted to execution by no more than a specified number of concurrent tasks.
When a task no longer requires access to the protected resource, it must release the semaphore using the osReleaseSemaphore function. If other tasks are waiting for the semaphore, the next task in the queue will acquire it. For more information regarding semaphore acquisition and management, please refer to the semaphore objects section.
The ReleaseCount value cannot exceed the number of successful wait operations performed by the task on the specified semaphore. The function will fail if the calling task does not currently hold the semaphore, or if the ReleaseCount is set to zero.
This function is available only when the OS_USE_SEMAPHORE configuration constant is set to 1.
| Version: | 1.0 |
|---|---|
| Header file: | OS_Semaphore.h (include OS_API.h) |
| See also: | BOOL, FALSE, HANDLE, INDEX, osCreateSemaphore, osGetLastError, semaphores, TRUE |