[DUG] Hang during Sleep
Jolyon Smith
jsmith at deltics.co.nz
Tue May 15 16:07:52 NZST 2012
For what it's worth I would say that Application.ProcessMessages is asking
for trouble. It sets up your code for a re-entrancy problem that it is
highly unlikely to cater for adequately (as you already found once, but
user input isn't the only potential source of messages that could cause
re-entrancy issues for your busy-wait loop).
If anything, I think the fact that this loop is (presumably) running on the
main thread in your app could be the source of your lock up issues,
precisely because of the need to keep that thread happily pumping your
applications message queue.
What is this busy-loop used for ? Can you not devise some other mechanism
to achieve the same result without having to go into a busy-wait loop and
putting the message loop on heart-bypass while you do so ?
Maybe a waitable timer ?
Or an event ?
(i.e. a "proper" thread synchronization technique, which is what this
appears to be trying to achieve)
Just a suggestion,
Jolyon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20120515/403a093e/attachment.html
More information about the Delphi
mailing list