@@ -39,6 +39,7 @@ module Network.Wai.Handler.Warp (
3939 , setFdCacheDuration
4040 , setBeforeMainLoop
4141 , setNoParsePath
42+ , setInstallShutdownHandler
4243 -- ** Getters
4344 , getPort
4445 , getHost
@@ -189,3 +190,15 @@ getPort = settingsPort
189190-- Since 2.1.1
190191getHost :: Settings -> HostPreference
191192getHost = settingsHost
193+
194+-- | A code to install shutdown handler.
195+--
196+-- For instance, this code should set up a UNIX signal
197+-- handler. The handler should call the first argument,
198+-- which close the listen socket, at shutdown.
199+--
200+-- Default: does not install any code.
201+--
202+-- Since 3.1.0
203+setInstallShutdownHandler :: (IO () -> IO ()) -> Settings -> Settings
204+setInstallShutdownHandler x y = y { settingsInstallShutdownHandler = x }