INtime SDK Help
OpenSemaphore, RtOpenSemaphore (iwin32)
INtime SDK v6 > About INtime > Alternate APIs > iwin32 API > iwin32 API > OpenSemaphore, RtOpenSemaphore (iwin32)

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
);

Parameters

dwDesiredAccess
Ignored.
bInheritHandle
Ignored.
lpName
Pointer to a null-terminated string that specifies the semaphore to open. Name comparisons are case sensitive.

Remarks

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.

Return Values

Handle to semaphore object
Success.
NULL
Failure. For extended error information, see GetLastError.

Requirements

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

See Also

CloseHandle, CreateSemaphore, ReleaseSemaphore, iwin32 API, iwin32 Overview