The OpenSemaphore function returns a handle of an existing named semaphore object.
HANDLE OpenSemaphore(
DWORD dwDesiredAccess, |
// access flag |
BOOL bInheritHandle, |
// inherit flag |
LPCTSTR lpName |
// pointer to semaphore-object name |
); |
This parameter can be any combination of the following values:
Access |
Description |
SEMAPHORE_ALL_ACCESS |
Specifies all possible access flags for the semaphore object. |
SEMAPHORE_MODIFY_STATE |
Enables use of the semaphore handle in the ReleaseSemaphore function to modify the semaphore’s count. |
SYNCHRONIZE |
Windows NT only: Enables use of the semaphore handle in any of the wait functions to wait for the semaphore’s state to be signaled. |
If the function succeeds, the return value is a handle of the semaphore object.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
The OpenSemaphore function enables multiple processes to open handles of the same semaphore object. The function succeeds only if some process has already created the semaphore by using the CreateSemaphore function. The calling process can use the returned handle in any function that requires a handle of a semaphore object, such as the wait functions, subject to the limitations of the access specified in the dwDesiredAccess parameter.
The handle can be duplicated by using the DuplicateHandle function. Use the CloseHandle function to close the handle. The system closes the handle automatically when the process terminates. The semaphore object is destroyed when its last handle has been closed.
CloseHandle, CreateSemaphore, DuplicateHandle, ReleaseSemaphore
file: /Techref/os/win/api/win32/func/src/f66_9.htm, 4KB, , updated: 2000/4/7 12:19, local time: 2024/8/22 19:33,
3.139.98.203:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/tecHREF/os/win/api/win32/func/src/f66_9.htm"> OpenSemaphore</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.