unit thrd;

interface

uses
  Classes;

type
  TSimpleThread = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
 public
   Count : Integer;
  end;

implementation

{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure TSimpleThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TSimpleThread }

procedure TSimpleThread.Execute;
Var
  I, Total, Avg : Integer;
begin
While True
  Do Begin
   Total := 0;
   For I := 1 To 10
   Do
     Inc( Total, Random( MaxInt ) );
   Avg := Avg Div 10;
   Inc( Count );
  End;
end;

end.
