From 03985084e42e262bac1b7c48a97c31db97348f1d Mon Sep 17 00:00:00 2001 From: Jan Kloetzke Date: Tue, 31 Jul 2012 21:08:31 +0200 Subject: erlsrv: gracefully stop emulator on Windows shutdown Windows will send the SERVICE_CONTROL_SHUTDOWN event to the service control handler when shutting down the system. Instead of ignoring the event, erlsrv will now invoke the stop action. Likewise, the Erlang emulator (and it's port drivers) must not quit upon reception of the CTRL_SHUTDOWN_EVENT event in the console control handler. --- erts/etc/win32/erlsrv/erlsrv_service.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'erts/etc/win32/erlsrv') diff --git a/erts/etc/win32/erlsrv/erlsrv_service.c b/erts/etc/win32/erlsrv/erlsrv_service.c index 242e2905a9..8b734b0c05 100644 --- a/erts/etc/win32/erlsrv/erlsrv_service.c +++ b/erts/etc/win32/erlsrv/erlsrv_service.c @@ -104,11 +104,10 @@ static VOID WINAPI handler(DWORD control){ log_debug(buffer); switch(control){ case SERVICE_CONTROL_STOP: + case SERVICE_CONTROL_SHUTDOWN: set_stop_pending(30000,1); SetEvent(eventStop); return; - case SERVICE_CONTROL_SHUTDOWN: - return; default: reset_current(); break; -- cgit v1.2.3