Thursday, July 11, 2013

WaitForMultipleObjects

Please take care while using WaitForMultipleObjects

Today I was trying one of the example given by Microsoft on Windows CE. 

Basically the code is written for Windows Desktop and the code can be seen at the following URL: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686927(v=vs.85).aspx.

In the above given example the main function is creating two threads and waiting for the threads to close using WaitForMultipleObjects API. 

As this example is for desktop in WaitForMultipleObjects API the third parameter fWaitAll is set to TRUE.

I made some modifications such as printf is changed to RETAILMSG and on entry and exit of main, thread function we have enable more RETAIL Messages.

After running the application we are not seeing any messages that are being printed from the worker threads. All we see is the main function entry and exit messages.

After debugging, we came to know that fWaitAll in WaitForMultipleObjects API shall be set to FALSE in Windows CE 6.0.

Hope This Helps.

No comments:

Post a Comment