Re: SendMessage (in secondary thread) freezes application GUI thre



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...



.



Relevant Pages

  • Re: SendMessage (in secondary thread) freezes application GUI thre
    ... Then, in the non-UI thread, check the flag. ... queue and, again, the third thread will process that. ... If the system is about to go into suspend mode, ... will probably suspend before the about-to-suspend message gets to the UI ...
    (microsoft.public.windowsce.app.development)
  • Re: Fast Start-up
    ... you could theoretically use information in RAM to make a decision on ... CE does not define the power of the board in suspend, ... Most of the boot time and resume time is in the OEM code. ...
    (microsoft.public.windowsce.embedded)
  • Re: General network driver suspend/resume (was e1000 carrier related)
    ... 7.3* version of the driver from sourceforge. ... Changing this to bring up the link would make the card start to consume lots more power, which would automatically suck enormously for anyone using a laptop. ... Perhaps this needs to be fixed upstream in pci_save_state for msi devices, but the api for msi is not capable of detecting this atm. ...
    (Linux-Kernel)
  • Re: Auto mail-check even if powered off?
    ... It takes seconds to download headers ... The power options don't seem to have an effect. ... > through my bluetooth phone, connect to my vpn here at home and then ... Suspend it again, wait, it downloads ...
    (microsoft.public.pocketpc)
  • Re: Save open files on suspend
    ... POWER_STATE_SUSPEND notification is really sent (the message written ... This code is called only when the system is about to suspend, ... in front of WaitForSingleObject in power manager. ... HANDLE hAckEvent = NULL; ...
    (microsoft.public.windowsce.platbuilder)