А ничего, что оба вычисления будут проведены практически мгновенно?
Код:
type
TForm1 = class(TForm)
...
end;
TThread1 = class(TThread)
res : Integer;
procedure Execute; override;
end;
TThread2 = class(TThread)
x : double
res : Double;
procedure Execute; override;
end;
implementation
procedure TThread1.Execute;
var
I : Integer;
begin
res := 0;
For I := 1 To 100 Do res := res + I;
end;
procedure TThread2.Execute;
begin
res := (2*cos(x-pi/6))/(0.5+sqr(sin(x)));
end;
procedure TForm1.Button1Click(Sender : TObject);
var
T1 : TThread1;
T2 : TThread2;
begin
T1 := TThread1.Create(True);
T2 := TThread2.Create(True);
T2.x := 15.8;
T1.Resume;
T2.Resume;
T1.WaitFor;
T2.WaitFor;
Memo1.Lines.Clear;
Memo1.Lines.Add('Sum = ' + IntToStr(T1.res));
Memo2.Lines.Add('Func = ' + FloatToStr(T2.res));
T1.Free;
T2.Free;
end;