This topic has not yet been rated - Rate this topic

COWAIT_FLAGS enumeration

Applies to: desktop apps only

Specifies the behavior of the CoWaitForMultipleHandles function.

Syntax

typedef enum tagCOWAIT_FLAGS {
  COWAIT_WAITALL                    = 1,
  COWAIT_ALERTABLE                  = 2,
  COWAIT_INPUTAVAILABLE             = 4,
  COWAIT_DISPATCH_CALLS             = 8,
  COWAIT_DISPATCH_WINDOW_MESSAGES   = 0X10 
} COWAIT_FLAGS;

Constants

COWAIT_WAITALL

If set, the call to CoWaitForMultipleHandles will return S_OK only when all handles associated with the synchronization object have been signaled. If not set, the call will return S_OK as soon as any handle associated with the synchronization object has been signaled.

COWAIT_ALERTABLE

If set, the call to CoWaitForMultipleHandles will return S_OK if an asynchronous procedure call (APC) has been queued to the calling thread with a call to the QueueUserAPC function, even if no handle has been signaled.

COWAIT_INPUTAVAILABLE

If set, the call to CoWaitForMultipleHandles will return S_OK if input exists for the queue, even if the input has been seen (but not removed) using a call to another function, such as PeekMessage.

COWAIT_DISPATCH_CALLS

Dispatch calls from CoWaitForMultipleHandles in an ASTA. Default is no call dispatch. This value has no meaning in other apartment types and is ignored.

COWAIT_DISPATCH_WINDOW_MESSAGES

Enables dispatch of window messages from CoWaitForMultipleHandles in an ASTA or STA. Default in ASTA is no window messages dispatched, default in STA is only a small set of special-cased messages dispatched. The value has no meaning in MTA and is ignored.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Objbase.h

See also

CoWaitForMultipleHandles
ISynchronize::Wait
ISynchronizeContainer::WaitMultiple

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Warning on COWAIT_WAITALL ... it also waits for a message to arive on the queue

CoWaitForMultipleHandles at some point calls MsgWaitForMultipleObejctsEx, and appears to use a WAIT_ALL if COWAIT_WAITALL is passed.

See Chris Brumme's blog entry: http://blogs.msdn.com/cbrumme/archive/2004/02/02/66219.aspx

“When you perform a pumping wait, at some level you need to call MsgWaitForMultipleObjectsEx, or a similar Msg* based variant.  But the semantics of a WAIT_ALL on an OS MsgWaitForMultipleObjectsEx call is rather surprising and not what you want at all.  It waits for all the handles to be signaled AND for a message to arrive at the message queue.  In other words, all your handles could be signaled and the application will keep blocking until you nudge the mouse!  Ugh.”