[Lazarus] TThread.WaitFor blocks the main event loop under Linux
Sven Barth
pascaldragon at googlemail.com
Tue Oct 12 10:38:07 CEST 2010
Am 11.10.2010 11:18, schrieb Michael Schnell:
> On 10/08/2010 06:40 PM, Luca Olivetti wrote:
>>
>> I'm surprised it works under windows: using synchronize and waitfor
>> has always been a no-no.
>
> Seemingly Synchronize is not implemented decently in Lazarus (while it
> seems to work perfectly as documented with Delphi).
>
> I suppose WaitFor is done with Messages and this seems to be completely
> broken for Linux in the latest svn version while it did work in former
> versions and seems still to be working with the Windows Widget Type.
If you take a look at rtl/unix/tthread.inc (
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/unix/tthread.inc?revision=15599&view=markup
) you'll see that WaitFor simply calls "WaitForThreadTerminate" which is
a Thread Manager function. This is set to CWaitForThreadTerminate on
Unix systems ( see
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/unix/cthreads.pp?revision=15557&view=markup
) and just calls pthread_join, which waits for the thread to terminate
(without a timeout or other gimmicks like on Windows).
Regards,
Sven
More information about the Lazarus
mailing list