On 17/09/2008, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > On 9/17/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> When you call synchronize from inside of you thread, this sends a message >> to >> application thread with the procedure that will be used to synchronize AND >> WAIT FOR a response from application thread of the execution of sync >> procedure. BUT when you call Thread.WaitFor in application thread, the >> application don't process any messages because it is waiting the thread >> finish, and thread don't finish because it is waiting a response of >> application thread of the execution of sync procedure... and you have your >> aplication freeze! > > This is exactly what seems to be happening... I'll try your > work-around and see how it goes. Thanks. > > Note: > I have no such issues in Delphi, using the exact same threading code. > So does that mean FPC has a bug in threading?
Delphi has code in its WaitFor function that prevents this deadlock from occuring. They basically wait on the SyncEvent and the handle of the thread, calling CheckSynchonize when the SyncEvent triggers. I'm not sure if this is possible with fpc, but I'm sure there must be a solution. henry _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal