[Lazarus] A few questions on threads

Luca Olivetti luca at wetron.es
Tue Oct 4 15:39:36 CEST 2011


Al 04/10/2011 15:24, En/na Mark Morgan Lloyd ha escrit:

>
> Thanks for that Michael. I've got a thread which runs for a stretch in
> the background to query a database (to avoid a UI glitch), then suspends
> itself until it's kicked back into life by the main thread approx 30
> seconds later. Appears reliable on all tested platforms.

Wait on a TEvent instead of suspending. Then provide a method that 
signals the TEvent, to be called by the main thread (and signal it also 
in the destructor, so execute can wake up and properly terminate).

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




More information about the Lazarus mailing list