@@ -1,10 +1,11 @@
11{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, ViewPatterns #-}
2−{-# LANGUAGE PatternGuards #-}
2+{-# LANGUAGE PatternGuards, RankNTypes #-}
33
44module Network.Wai.Handler.Warp.Settings where
55
66import Control.Exception
7−import Control.Monad (when)
7+import Control.Monad (when, void)
8+import Control.Concurrent (forkIOWithUnmask)
89import qualified Data.Text as T
910import qualified Data.Text.IO as TIO
1011import Data.Streaming.Network (HostPreference)
@@ -52,6 +53,17 @@ data Settings = Settings
5253 -- Default: do nothing.
5354 --
5455 -- Since 1.3.6
56+
57+ , settingsFork :: ((forall a. IO a -> IO a) -> IO ()) -> IO ()
58+ -- ^ Code to fork a new thread to accept a connection.
59+ --
60+ -- This may be useful if you need OS bound threads, or if
61+ -- you wish to develop an alternative threading model.
62+ --
63+ -- Default: void . forkIOWithUnmask
64+ --
65+ -- Since 3.0.4
66+
5567 , settingsNoParsePath :: Bool
5668 -- ^ Perform no parsing on the rawPathInfo.
5769 --
@@ -85,6 +97,7 @@ defaultSettings = Settings
8597 , settingsManager = Nothing
8698 , settingsFdCacheDuration = 10
8799 , settingsBeforeMainLoop = return ()
100+ , settingsFork = void . forkIOWithUnmask
88101 , settingsNoParsePath = False
89102 , settingsInstallShutdownHandler = const $ return ()
90103 , settingsServerName = S8.pack $ "Warp/" ++ showVersion Paths_warp.version