I have a code in Delphi which does the following:
procedure THilo.Execute; // (which is the thread)
begin
inherited;
FreeOnTerminate := True;
while not Terminated do
begin
(...)
Sleep(100);
end;
end;
and now somewhere else, in another thread (or the GUI) we do this:
var
Hilo2: THilo;
begin
Hilo2 := THilo.Create(True);
Hilo2.start;
Hilo2 := THilo.Create(True);
Hilo2.start;
end;
now we have executed 2 times the same thread, and they are running in parallel. What happens if we do now this?:
Hilo2.Terminate;
will this terminate both threads or just 1, or what? also, if we would like to terminate it, could we achieve this by .Resume()?
Thanks in advance