In a Linux Free Pascal 2.6.0 console application, a HTTP server is started and runs in a separate thread, so the call to Start will immediately return.
begin
...
MyHTTPServer.Start;
...
WriteLn('Application terminated');
end;
To keep the console from closing I could use a simple endless loop like:
// wait, read and ignore input from stdin
while True do ReadLn;
or
// Sleep as long as possible
while True do Sleep(MaxInt);
Which one would you prefer? Or is there a better way to keep the application running?