unlock' = closeFd
withPidFile :: FilePath -> IO a -> IO a
-withPidFile lockfile = bracket mkPid' (const delPid') . const
+withPidFile lockfile = bracket_ mkPid' delPid'
where
mkPid' :: IO ()
mkPid' = withFile lockfile WriteMode $ \ h ->
import Control.Concurrent
import Control.Concurrent.STM
+import Control.Exception
import Control.Monad
import Data.Maybe
import Data.Set (Set)
startIndexManager lsdir repos mkDraft
= do chan <- newTChanIO
index <- openIndex indexDir revFile
- _ <- forkIO (loop chan index)
+ _ <- forkIO (loop chan index `finally` closeDatabase index)
return chan
where
indexDir = lsdir </> "index"