tags:

views:

292

answers:

2

Is it possible to enter an alertable wait state using MsgWaitForMultipleObjects() / MsgWaitForMultipleObjectsEx()?

A: 

MsgWaitForMultipleObjectsEx puts the thread in an alertable wait state.

From MSDN on SleepEx:

A thread goes into an alertable wait state by calling either SleepEx, MsgWaitForMultipleObjectsEx, WaitForSingleObjectEx, or WaitForMultipleObjectsEx, with the function's bAlertable parameter set to TRUE.

Richard
Yeah, but MsgWaitForMultipleObjectsEx doesn't have a bAlertable parameter. Does it just go into alertable state by default?
@Ee Zz: To expand on that, the only difference (as far as I am aware) between MsgWaitForMultipleObjectsEx and MsgWaitForMultipleObjects is the former is alterable, thus no separate parameter or flag is needed.
Richard
+2  A: 

it is possible to enter into an alertable wait if you specify MWMO_ALERTABLE flag as the last parameter (dwFlags - the wait type)

Andrey