[Lazarus] How to cleanly terminate "http server application"/"fastcgi application"?
Michael Van Canneyt
michael at freepascal.org
Tue Apr 14 08:40:41 CEST 2015
On Tue, 14 Apr 2015, Luca Olivetti wrote:
> I couldn't find a built-in way to cleanly terminate them, so I had to
> install a signal handler to issue an Application.Terminate.
> Is there a provided way that I missed?
No. Calling Terminate is what needs to be called.
How/when this needs to be called is up to you.
Installing a signal handler is one way (a good one).
I sometimes install a password protected URL handler that calls terminate.
> BTW, also, they don't daemonize under Linux/run as service under
> windows. Maybe they aren't supposed to?
They are not supposed to.
That kind of thing is a design decision only you can make.
This is the reason why web components have the TWebHandler and TApplication classes split:
the webhandler does the work, the TApplication part determines what kind of application it is.
I have executables that can run as a service or as a normal binary.
Michael.
More information about the Lazarus
mailing list