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

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • VMware vCloud® Government Service provided by Carpathia® is an enterprise-class hybrid cloud service that delivers the tried and tested VMware capabilities widely used by government organizations today, with the added security and compliance assurance of FedRAMP authorization. The hybrid cloud is becoming more and more prevalent – in fact, nearly three-fourths of large enterprises expect to have hybrid deployments by 2015, according to a recent Gartner analyst report. Learn about the benefits of …

Most Popular Programming Stories

More for Developers

RSS Feeds