]> granicus.if.org Git - apache/commit
mpm_winnt: Advertise support for preshutdown notifications in the service,
authorEvgeny Kotkov <kotkov@apache.org>
Tue, 11 Jul 2017 21:39:35 +0000 (21:39 +0000)
committerEvgeny Kotkov <kotkov@apache.org>
Tue, 11 Jul 2017 21:39:35 +0000 (21:39 +0000)
commitd840509590f49faf9145d027c3c544deb1f7f279
tree3173064d6d5f02ead49450a0e37f6f4e0053d29a
parent5c5a7310abed490f6a2f1f197a7038d4bf37a543
mpm_winnt: Advertise support for preshutdown notifications in the service,
and perform shutdown in respond to SERVICE_CONTROL_PRESHUTDOWN.

The pure shutdown notification leaves a small amount of time for the service
to finish (and the allowed amount of time has been shrinking with every new
version of Windows), and handling only it increases the chance of the process
being killed by SCM, instead of gracefully shutting down.  Handling the
preshutdown control code extends this period, and increases the chances of
finishing everything properly when the machine is rebooted or shut down.

(See https://msdn.microsoft.com/en-us/library/windows/desktop/ms683241)

Please note that although the preshutdown notifications are available only
starting from Windows Vista, the code is compatible with the previous versions
of Windows, since the SCM ignores unknown SERVICE_ACCEPT codes, and will
still send an ordinary SERVICE_CONTROL_SHUTDOWN under old Windows
versions.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1801659 13f79535-47bb-0310-9956-ffa450edef68
server/mpm/winnt/service.c