[Lazarus] Tracking down an intermittent termination exception

Luca Olivetti luca at wetron.es
Tue Mar 26 13:42:40 CET 2013


Al 26/03/13 11:46, En/na Sven Barth ha escrit:

> Solution: Tell the thread to terminate (if you use the thread's
> Terminate property you'll need to check this inside your thread's loop)
> and then wait for (TThread.WaitFor) it to finish before you continue
> with termination.

Calling WaitFor on a thread that could be in a Synchronize call was a
no-no in delphi (and AFAIK even in Lazarus) since it could produce a
deadlock.
That's not the case anymore?
Because of that I always use a workaround: I set a boolean at the end of
the thread and, in the main thread, when I want to terminate the thread,
after calling Terminate I loop on a CheckSynchronize call waiting for
that boolean to become true.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007




More information about the Lazarus mailing list