osReleaseSemaphore function
BOOL osReleaseSemaphore(
  HANDLE Handle,
  INDEX ReleaseCount,
  INDEX *PrevCount

Handle of the semaphore object.


A value by which the semaphore counter will be increased.


A pointer to variable that receive value of the semaphore counter before release.

Return value:

TRUE on success or FALSE on failure. Use osGetLastError function to obtain extended error information.


Function releases semaphore object.

Semaphores are objects that ensure the synchronization during the access to critical section. A code protected by critical section controlled by semaphore, will be not performed by more than specified number of tasks.

When the task does not need to be any longer critical section owner, semaphore should be released with the osReleaseSemaphore function. If another task is waiting for this object, it will acquire the semaphore. For more information about acquiring the semaphore please refer to the semaphore objects section.

The ReleaseCount cannot by higher than the number of success waits for a semaphore object performed by a task that released the semaphore. Function will fail if the calling task does not own the semaphore object, or the ReleaseCount is zero.

Function is available only, when the value of OS_USE_SEMAPHORE constant is set to 1.

Header file:OS_Semaphore.h (include OS_API.h)
See also: BOOL, FALSE, HANDLE, INDEX, osCreateSemaphore, osGetLastError, semaphores, TRUE
SpaceShadow documentation