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

Handle of the counting semaphore object.


A value by which the semaphore counter will be increased.


A pointer to variable that receives the 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 a counting semaphore object.

Counting semaphores are used to synchronize the access to a resource. Only the defined number of tasks can use the resource in a specified time.

When the task does not need to use a resource any longer, it should release it by using the osReleaseCountSem function. The semaphore counter will be increased to the value passed in ReleaseCount. If any other task waits for this object it will acquire the semaphore. For more information on the counting semaphore see the counting semaphore objectssection.

Function will fail when the ReleaseCount is zero or the value of semaphore counter after operation exceeds the maximal specified counter value. When function fails, the semaphore counter value will be not modified.

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

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