From a144b56928bb16691a1749ea7d1179eeb74aa205 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 7 Nov 2012 14:35:31 +0200 Subject: [PATCH] Warning about fork vs resourceForkIO --- yesod-core/Yesod/Handler.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yesod-core/Yesod/Handler.hs b/yesod-core/Yesod/Handler.hs index bc0f15c7..f84bcf51 100644 --- a/yesod-core/Yesod/Handler.hs +++ b/yesod-core/Yesod/Handler.hs @@ -1034,6 +1034,10 @@ instance MonadIO (GHandler sub master) where liftIO = GHandler . const . lift instance MonadBase IO (GHandler sub master) where liftBase = GHandler . const . lift +-- | Note: although we provide a @MonadBaseControl@ instance, @lifted-base@'s +-- @fork@ function is incompatible with the underlying @ResourceT@ system. +-- Instead, if you must fork a separate thread, you should use +-- @resourceForkIO@. instance MonadBaseControl IO (GHandler sub master) where data StM (GHandler sub master) a = StH (StM (ResourceT IO) a) liftBaseWith f = GHandler $ \reader ->