在Linux Free Pascal 2.6.0控制台应用程序中,启动并在单独的线程中运行HTTP服务器,因此调用Start会立即返回。
为了防止控制台关闭,我可以使用一个简单的无限循环代码块,例如:
你更倾向于哪种方式?或者有更好的方法来保持应用程序运行吗?
begin
...
MyHTTPServer.Start;
...
WriteLn('Application terminated');
end;
为了防止控制台关闭,我可以使用一个简单的无限循环代码块,例如:
// wait, read and ignore input from stdin
while True do ReadLn;
或者
// Sleep as long as possible
while True do Sleep(MaxInt);
你更倾向于哪种方式?或者有更好的方法来保持应用程序运行吗?