reorganize and refactor lock code

Added a convenience Utility.LockFile that is not a windows/posix
portability shim, but still manages to cut down on the boilerplate around
locking.

This commit was sponsored by Johan Herland.
This commit is contained in:
Joey Hess 2014-08-20 16:45:58 -04:00
parent 0a4d301051
commit d279180266
9 changed files with 90 additions and 76 deletions

View file

@ -5,20 +5,12 @@
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Types.LockPool (
LockPool,
LockHandle
) where
import qualified Data.Map as M
#ifndef mingw32_HOST_OS
import System.Posix.Types (Fd)
type LockHandle = Fd
#else
import Utility.WinLock -- defines LockHandle
#endif
import Utility.LockFile
type LockPool = M.Map FilePath LockHandle