Article ID: 951322 - View products that this article applies to.
This article has been archived. It is offered "as is" and will no longer be updated.
The WaitForMultipleObjects() function does not work correctly together with pseudohandles in Windows XP, in Windows Server 2003, or in Windows Vista.
Consider the following sample code.
After you run the sample code, you expect the function to return after three seconds. However, it returns a "WAIT_FAILED" error, and it does not wait.
To work around this issue, use the DuplicateHandle() function to convert the pseudohandles to a real process handle.
For example, use the following sample code.
This issue occurs because the pseudohandle is a special constant that is interpreted as the current thread or the process handle. The calling thread can use this handle to specify itself when a thread handle is required. These handles cannot be referred by other threads. A pseudohandle is always interpreted as referring to the thread that is using it.
The pseudohandle does not have to be closed when it is no longer needed. Calling the CloseHandle() function for this handle has no effect.
A process uses the GetCurrentProcess() function or the GetCurrentHandle() function to obtain a handle to itself. This handle is a pseudohandle. However, the DuplicateHandle() function converts it to a real process handle.
Article ID: 951322 - Last Review: January 16, 2015 - Revision: 2.0