How to stop loop process inside TidPeerThread?

Hi to all,

I have a server application with a server side socket that has the
following methods:

procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
  Msg : string;
begin
  while AThread.Connection.Connected do
  begin
    Msg := AThread.Connection.ReadLn;
    if UpperCase(Copy(Msg, 1, 3)) = 'GO:' then
    begin
       RunLongProcedure()
    end
    else if UpperCase(Copy(Msg, 1, 5)) = 'STOP:' then
    begin
       StopProcess := TRUE;
    end
  end; { while Thread.Connection.Connected }

end;

and
procedure TForm.RunLongProcedure() // This could take a very long
time.
begin
  While not EOF...
  begin
    ReadRecordFromFile and ProcessRecord.
    if StopProcess the break;
  end;
end;

On the client side I do a :

idTCPCLient.WriteLN('GO:'); (with idTCPClient1)

The program works fine, however I want to be able to some how
interrupt the RunLongProcedure process if the client requires.

To do this, I put in a stop button that does the following but with
another client connection component:
idTCPClient2.WriteLn('STOP:'). (with idTCPClient2).

This works fine as well since there are now two TidPeerThreads and the
stop thread sets the global variable and the processing thread reads
it and breaks out of the loop.

Both idTCPClient1 and idTCPClient2 are in the same client application
and only one client application will ever be run.

However, I would like to know if there is a better way of interrupting
the RunLongProcedure loop process?

Thanks
Steven.