En/na Graeme Geldenhuys ha escrit:
procedure TtiLogToCacheAbs.Terminate;
begin
writeln('>> TtiLogToCacheAbs.Terminate');
FThrdLog.Terminate;
writeln(' called .Terminate() and now calling .WaitFor()');
FThrdLog.WaitFor;
writeln('<< TtiLogToCacheAbs.Terminate');
end;
Any ideas?
Do you call synchronize inside the thread?
Anyway, I don't usually call WaitFor (I've had many problems with it), I
set a flag in the thread and I loop sleeping (or calling
checksynchronize if the thread uses synchronize) until it's true, eg:
procedure TMyThread.execute;
begin
while not terminated do
begin
....
end;
finished:=true;
end;
MyThread.Terminate;
while not MyThread.Finished do sleep(100);
or
while not MyThread.Finished do CheckSynchronize(100);
Bye
--
Luca
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal