7.4. Wait Functions
Windows provides two wait functions,WaitForSingleObject andWaitForMultipleObjects, that allow you to "wait on handles." See Section 1.5 for a description of objects and handles in the 32-bit API. We have used these two functions extensively in the previous sections to wait on events, mutexes, and semaphores.
All handles have two states: signaled and unsignaled. The WaitForSingleObject function waits efficiently (blocks) until the handle it is waiting on becomes signaled.
WaitForSingleObject | Causes a thread to wait for a signal |
DWORD WaitForSingleObject( HANDLE object, DWORD timeout) | |
object | The object to wait for |
timeout | The maximum amount of time to wait, in milliseconds |
Returns an error code or the event that caused it to stop ... |
Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.