[fpc-pascal] How to use TThread?

silvioprog silvioprog at gmail.com
Thu Apr 18 19:48:17 CEST 2013


2013/4/18 Antonio Fortuny <a.fortuny at sitasoftware.lu>

>  First of all change the order of lines 25-26
>     inherited Create(False);
>     FreeOnTerminate := True;
>
> instead of
>     FreeOnTerminate := True;
>     inherited Create(False);
>
> The, drop the DoExecute procedure and replace it by the Execute procedure.
> It is useless to Synchronize a thread's procedure inside itself !
> After the creation, the thread executes immediately the overriden
> procedure Execute because, at creation time (inherited Create(False); ) the
> thread is created in the state NON SUSPENDED. The use of the DoExecute is
> obviously useless
> our program will execute the procedure Excute only once as there is no
> loop.
>
>
>    [image: Sita Software]   *Antonio Fortuny*
> Senior Software engineer
>
> 220, avenue de la Liberté
> L-4602 Niederkorn
> Tel.: +352 58 00 93 - 93
> www.sitasoftware.lu
>   [image: Your IT Partner]
>
>
Thank for the explanation. ;)

--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130418/3c8693d7/attachment.html>


More information about the fpc-pascal mailing list