Re: Firing an event from a worker thread
Unfortunately that means your application has a problem.
Most likely it handles its shutdown when processing that
message and it can't finish before you have returned from
your Release call. I just can't give you a good advice here
unfortunately...
One way to completely sidestep the whole issue is changing
the way you deliver events. Don't fire them from the worker
thread - use the hidden window technique instead. See this
FAQ article for a framework:
http://www.mvps.org/vcfaq/com/11.htm
This eliminates your need for AtlWaitWithMessageLoop, and
perhaps you won't even need to initalize COM on your worker
thread (though you may need it for other reasons, I don't know).
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Chris" <chris@scadaengine.com> wrote in message
news:1154914060.146439.190750@n13g2000cwa.googlegroups.com...
Alexander Nickolov wrote:
Seems ok to me. Not sure why are you posting WM_QUIT,
however. If you are eating a WM_QUIT in your message
loop, then there's a problem elsewhere.
I found that if I use AtlWaitWithMessageLoop in FinalRelease, then the
application does not exit. It's not a deadlock, the worker thread exits
ok and then there are still 2 threads running.
There is a message (0x1047) that is available, and it is being
dispatched by AtlWaitWithMessageLoop. I don't know what this message
does and it is there if I disable the Events from being fired from the
worker thread.
If I post a WM_NULL message, then the application exits cleanly, but I
can't explain why I need to post another message.