DoEvents equiv?

Alex Martelli aleaxit at yahoo.com
Fri May 11 05:14:45 EDT 2001


"Carlos Ribeiro" <cribeiro at mail.inet.com.br> wrote in message
news:mailman.989545593.22627.python-list at python.org...
    ...
> work to keep everything running without any process starving. If a single
> process stops checking the message queue, the process is dead though. When
> it happens you need to Ctrl-Alt-Del|Finalize to kill the process.

Just one side note: it's particularly problematic if a process (actually
thread, but that's another issue) is not serving its message queue *WHEN
IT OWNS WINDOWS*.  Unfortunately the process may not be AWARE it owns any
window (the service control manager, or some other library, may have
created a hidden toplevel window for whatever purposes).

This will forever block any OTHER process (thread, actually) that is
so ill-advised as to use a SendMessage (rather than SendMessageTimeout)
API call with a target of HWND_BROADCAST.  But then nobody would be
so silly as to do THAT, right?  ALas... DDEML (the library that MS,
lo so many years ago, wrote and distributed to make it easier to use
the DDE IPC protocol) does exactly that.  This bug has been known and
well-documented on MSDN for 6 years.  Microsoft does not plan to fix
it -- no doubt part of their plans to kill DDE in favour of COM based
protocols (which are indeed vastly preferable IPC approaches -- _but_
some application developers are stubbornly clinging to DDE anyway...
and they tend to use DDEML, _with_ its bug [that they may be unaware
of], rather than raw DDE window-messages [harder to use, sigh]).

As a consequence, it WOULD be "good citizenship" for _any_ process
(thread) to serve its message queue _anyway_ -- just in case it may
have sprung some window without knowing, and just in case some other
process that uses DDEML might otherwise get hung...


Alex






More information about the Python-list mailing list