Searches for an existing semaphore with the given name and returns its handle.
HANDLE OpenSemaphore( DWORD dwDesiredAccess, BOOLEAN bInheritHandle, LPCTSTR lpName ); HANDLE RtOpenSemaphore( DWORD dwDesiredAccess, BOOLEAN bInheritHandle, LPCTSTR lpName );
dwDesiredAccess
bInheritHandle
lpName
RtOpenSemaphore can also be used from a Windows application to obtain the handle of an iwin32 process.
OpenSemaphore enables multiple processes to open handles of the same semaphore object. The function succeeds only if a process already created the semaphore by using CreateSemaphore. The calling process can use the returned handle in any function that requires a handle to a semaphore object, such as the wait functions.
To close the handle, use CloseHandle. When the process terminates, the system automatically closes the handle. After the last handle closes, the semaphore object is destroyed.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/iwin32.h intime/rt/include/winbase.h |
iwin32.h windows.h |
iwin32.lib |
Notes
CloseHandle, CreateSemaphore, ReleaseSemaphore, iwin32 API, iwin32 Overview