Using a Non-Blocking Versions of Win32 Wait Functions

Environment: VC6, NT4/2000/XP

Current implementations of the Win32 wait functions—such as Sleep(), WaitForSingleObject(), and WaitForMultipleObjects()—will block the message pump when called on a window thread. A special case of this is a thread that calls CoInitialize(), resulting in potentially blocking COM method calls to an object. The attached code is a MS VC++ static library project that caters to this problem by using MsgWaitForMultipleObjects to rewrite the functions such that if there are pending messages in the message queue, they are processed during the wait.

Downloads

Download source - 3.28 Kb


Comments

  • Use CoWaitForMultipleHandles

    Posted by Legacy on 08/01/2002 12:00am

    Originally posted by: Dudi Avramov

    There is a good API,called CoWaitForMultipleHandles, that does what you need.
    Read about it.


    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Email is the most common communication vehicle used by organizations of all shapes and sizes. Among the billions of email messages sent every day are sensitive information, critical requests, and other essential business data. IT staff bear the burden of ensuring the confidentiality, integrity, and availability of the information contained within the communication. This white paper explores the email security landscape, an assessment of the threats organizations face,  and the building blocks of an effective …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds