osOpenSemaphore function
Declaration:
HANDLE osOpenSemaphore(
  SYSNAME Name
);
Parameters:
Name

Name of the semaphore object.

Return value:

The return value is a handle to the opened semaphore object when success or NULL_HANDLE on failure. Use osGetLastError function to obtain extended error information.

Description:

Function opens existing 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.

During semaphore creation, an optional semaphore name may be specified. It makes tasks able to open it by osOpenSemaphore function. The non-used semaphore should be closed with the osCloseHandle. Semaphore will be deleted when it is closed by all tasks that opened it. More information you can find in the system objects management section.

If all of the osOpen* functions are not used, the system ignores an object name and the code used to name management will be removed. It will reduce final size of the output code. For more information about the names and object opening see the system objects management section.

A returned handle can be used acquire the semaphore object. For more information about acquiring the semaphore please refer to the semaphore objects section.

Function is available only, when the value of OS_USE_SEMAPHORE and OS_OPEN_SEMAPHORE_FUNC constants are set to 1. If the function is not used, set the OS_OPEN_SEMAPHORE_FUNC to 0 to reduce the output code.

Version:1.0
Header file:OS_Semaphore.h (include OS_API.h)
See also: HANDLE, NULL_HANDLE, OS_OPEN_SEMAPHORE_FUNC, osCloseHandle, osCreateSemaphore, osGetLastError, semaphores, SYSNAME, system objects management
SpaceShadow documentation