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.


Sita
                  Software
Antonio Fortuny
Senior Software engineer

220, avenue de la Liberté
L-4602 Niederkorn
Tel.: +352 58 00 93 - 93
www.sitasoftware.lu
Your IT Partner
Le 18/04/2013 07:03, silvioprog a écrit :
Hi,

I tried to use TThread in a small sample, but it don't works. The code is very simple, and I'm sending it in attached.

Thanks,

--
Silvio Clécio
My public projects - github.com/silvioprog


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to