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

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds