-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | thread-friendly file locks that don't block the entire program -- -- This module provides file locks that (unlike their counterparts in -- System.Posix.IO) leave other threads running while one waits for the -- lock. @package colock @version 0.2.2 -- | System.IO.Lock provides thread-friendly file locks. The locking -- functions in System.Posix.IO (actually, it's just -- System.Posix.IO.waitToSetLock) will block the entire program, -- not just the calling thread (even with the threaded runtime). This -- module avoids the problem by spawning a new process for each lock and -- communicating with it over pipes. -- -- Advantages: -- -- -- -- Disadvantages: -- -- -- -- Oddities: -- -- module System.IO.Lock data LockMode LockRead :: LockMode LockWrite :: LockMode data LockDescriptor -- | setLock locks the specified region of the file. It blocks the -- calling thread until the lock is granted. setLock :: Fd -> (LockMode, SeekMode, FileOffset, FileOffset) -> IO LockDescriptor -- | setLockAll fd lm is equivalent to setLock -- fd (lm, AbsoluteSeek, 0, 0). It locks the entire file, no -- matter how big it is. setLockAll :: Fd -> LockMode -> IO LockDescriptor -- | unLock destroys the given lock. unLock :: LockDescriptor -> IO () instance Typeable LockDescriptor instance Typeable LockMode instance Show LockDescriptor instance Eq LockMode instance Ord LockMode instance Read LockMode instance Show LockMode instance Enum LockMode instance Bounded LockMode