osReleaseCountSem function
Declaration:
BOOL osReleaseCountSem(
  HANDLE Handle,
  INDEX ReleaseCount,
  INDEX *PrevCount
);
Parameters:
Handle

The handle of the counting semaphore object to be released.

ReleaseCount

The amount by which the semaphore's internal counter will be incremented.

PrevCount

A pointer to a variable that receives the value of the semaphore counter as it was prior to this release operation.

Return value:

Returns TRUE on success or FALSE on failure. To retrieve extended error information, call the osGetLastError function.

Description:

This function releases a counting semaphore object, incrementing its internal counter.

Counting semaphores are utilized to synchronize access to shared resources, ensuring that no more than a specified number of tasks can utilize the resource concurrently.

When a task no longer requires access to the resource, it should release it by calling the osReleaseCountSem function. The internal semaphore counter will be incremented by the value specified in the ReleaseCount parameter. If other tasks are currently waiting for this object, the next task in the queue will acquire the semaphore. For more detailed information, please refer to the counting semaphore objects section.

The function will fail if ReleaseCount is zero or if the resulting counter value would exceed the maximum value specified during the semaphore's creation. In the event of a failure, the semaphore counter remains unmodified.

This function is available only when the OS_USE_CNT_SEM configuration constant is set to 1.

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