I have created an application and have implemented threading like this:
Is this an acceptable way to use threads, or is there a better way. Thanks in advance.
------------------------------------
There's no place like 127.0.0.1
------------------------------------
Code:
[b]implementation[/b]
var
...
//type for retrieving invoices --> runs in it's own thread
type TRetrieveInvoice = class(TThread)
protected
procedure Execute; override;
end;
...
//procedure to start a Mass Import
procedure TfrmMain.InitiateImport;
var
InvoiceThread : TRetrieveInvoice;
begin
//begin importing items and descriptions
InvoiceThread := TRetrieveInvoice.Create(True);
InvoiceThread.FreeOnTerminate := True;
InvoiceThread.Resume;
end;
...
//execute invoice in own thread
procedure TRetrieveInvoice.Execute;
var
..
begin
...
end;
Is this an acceptable way to use threads, or is there a better way. Thanks in advance.
------------------------------------
There's no place like 127.0.0.1
------------------------------------