Re: SendMessage (in secondary thread) freezes application GUI thre
- From: skyapie <skyapie@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 20 Nov 2006 08:10:02 -0800
Yupyup I tried it... I even commented out all the places I could find Waits
and semaphores... and just disabled those functions that had it.... the
problem wasn't there... it was still freezing... I still appreciate your help
though, I've learnt a bit at least :)
Then I put logging statements in the OnDraw function, and found out it was
freezing in there. I had a call to "GetSystemPowerStatusEx2" to get the
battery power every time the screen had to be re-drawn, and it would often
hang in there. Once I removed the call to display the percentage of battery
power left, the application stopped hanging...
I tried reducing the frequency of the calls, to once per minute instead of
once every OnDraw, but that still caused the application to freeze.... I was
just thinking of putting it in a different thread so even if that thread
died.... the main thread wouldn't be affected. (but that kind of hides the
problem even more...)
It was kind of weird that it was dying there.... but at least the source of
the problem's found :) I can now look for a solution :)
"Michael J. Salamone" wrote:
Did you try the suggestion I made earlier?.
Does the UI thread ever do a Wait (or other blocking call)? Any
chance it doesn't come out of that wait (i.e. what circumstances
would cause it to wait forever)?
You could try setting a flag just before waiting and then clearing
after the
wait. Then, in the non-UI thread, check the flag. If the flag is
set,
throw up a MessageBox. Then attach the debugger to the program and
get some stack traces.
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"skyapie" <skyapie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:23E99DE6-7FDA-4A69-9EE4-808D48D4C3D5@xxxxxxxxxxxxxxxx
Thanks for that Paul.
Now I just got to figure out which message getting processed is the one
causing the deadlock.... (any clues as to how to do this?)
Thanks :)
"Paul G. Tobey [eMVP]" wrote:
One or the other will win and that message will end up in the queue
first,
will, presumably, be handled first by the third thread, and that
application
will be released first. Then the next message will be at the top of the
queue and, again, the third thread will process that.
What's the question? If the system is about to go into suspend mode, it
will probably suspend before the about-to-suspend message gets to the UI
thread. When the device resumes, that message will still be there...
Paul T.
"skyapie" <skyapie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BB5466B6-F02A-4F1E-9285-9B230BFD58F7@xxxxxxxxxxxxxxxx
Hi guys, me again... =)
I have a question... what happens if there are 3 threads, and 2 threads
simultaneously do a "SendMessage" to the third one?
Plus, what if Thread A is actually sending a message to the UI thread,
saying that it has received a Power Broadcast message, and that the
system
was about to go into suspend mode... and the UI thread was in the
middle
of
processing Thread B's message?
Thanks...
- References:
- Re: SendMessage (in secondary thread) freezes application GUI thread?
- From: Paul G. Tobey [eMVP]
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: skyapie
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: Paul G. Tobey [eMVP]
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: Michael J. Salamone
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: skyapie
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: Paul G. Tobey [eMVP]
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: skyapie
- Re: SendMessage (in secondary thread) freezes application GUI thre
- From: Michael J. Salamone
- Re: SendMessage (in secondary thread) freezes application GUI thread?
- Prev by Date: Re: C# - C interop
- Next by Date: Re: Unable to Run Service Under Emulator
- Previous by thread: Re: SendMessage (in secondary thread) freezes application GUI thre
- Next by thread: Re: SendMessage (in secondary thread) freezes application GUI thre
- Index(es):
Relevant Pages
|