Kristao
asked on
how to control Thread
helow
so here's my programm
i have program wich reads rows from table after its read one row programm [with TThread] sends a file to specific location.
this all works just fine but how to control this TThreads how can i know when all Threads i made finished the job.
///exsample
var finished:boolean;
programm makes 25 Threads
after all Threads finished the job >>> finished:=true;
/////////////////
thx to u
so here's my programm
i have program wich reads rows from table after its read one row programm [with TThread] sends a file to specific location.
this all works just fine but how to control this TThreads how can i know when all Threads i made finished the job.
///exsample
var finished:boolean;
programm makes 25 Threads
after all Threads finished the job >>> finished:=true;
/////////////////
thx to u
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
? why not let the therad finish itself ?
:) becouse i need to know when all threads are finished becouse some smart ass can close the programm and all thread will be terminated even when thread is in progress :)
my programm is server so when its gets connection wich ask to make the job then reciveconnection:= false and while thread are in progres reciveconnection will still be false i need to know when last last thread ends so i could put reciveconnection:=true :)
i made something like this:
i made one counter its name is ct:integer;
ct:=rowcount
while not(table.eof) do begin
sends procedure to execute
end;
procedure Tname.Execute;
begin
Sendfile(dend procedure here);
synchronize(StB);
end;
procedure TName.StB;
begin
inc(ct);
gpr_tredi.MaxValue =ct then
begin
reciveconnection := true;
end
else begin
lb_status.Caption := 'TThread in progress';
lb_status.Refresh;
end;
end;
yes its works :)
i just thout there is something more interesting then my version but thanks for good ideas
:) becouse i need to know when all threads are finished becouse some smart ass can close the programm and all thread will be terminated even when thread is in progress :)
my programm is server so when its gets connection wich ask to make the job then reciveconnection:= false and while thread are in progres reciveconnection will still be false i need to know when last last thread ends so i could put reciveconnection:=true :)
i made something like this:
i made one counter its name is ct:integer;
ct:=rowcount
while not(table.eof) do begin
sends procedure to execute
end;
procedure Tname.Execute;
begin
Sendfile(dend procedure here);
synchronize(StB);
end;
procedure TName.StB;
begin
inc(ct);
gpr_tredi.MaxValue =ct then
begin
reciveconnection := true;
end
else begin
lb_status.Caption := 'TThread in progress';
lb_status.Refresh;
end;
end;
yes its works :)
i just thout there is something more interesting then my version but thanks for good ideas
Hope this helps!
Evarest