[fpc-devel] TProcess.Terminate
Michael Van Canneyt
michael at freepascal.org
Fri Oct 5 09:34:52 CEST 2007
On Fri, 5 Oct 2007, Micha Nelissen wrote:
> Michael Van Canneyt wrote:
> > It's modelled on Windows. There terminate doesn't ask questions.
> > Hence the implementation.
>
> Then it's badly modelled.
>
> There is no way on windows to "cleanly" ask a process to terminate ? Send it a
> WM_QUIT message or so ?
The Terminate call in windows is the equivalent of sending a KILL.
So the unix call is even rather 'soft'.
What concerns a WM_QUIT: you need a window handle for this, and you
don't have that in e.g. a command-line program or service.
If you want a more 'friendly' way, I think we should add a call
'TryTerminate(Timeout : Integer)' or something, which tries to
send a WM_QUIT on windows and which sends a TERM on Linux; after
TimeOut milliseconds it should probe to see whether the process
actually stopped.
Michael.
More information about the fpc-devel
mailing list