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
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to