on master help sign in
remove extraneous unlock in closeLockFile
commit64dfd802e6fe82fee44d61067d0af2c67979a917 authorAgentM <agentm@themactionfaction.com> dateSat 20 Jan 2018, 15:27 (9 years ago) parentf167476
2 files changed+3−5
src/lib/ProjectM36/FileLock.hs+2−4 src/lib/ProjectM36/TransactionGraph/Persist.hs+1−1
src/lib/ProjectM36/FileLock.hs+2−4
@@ -35,7 +35,6 @@ openLockFile path = createFile path
3535
3636closeLockFile :: LockFile -> IO ()
3737closeLockFile file = do
38− unlockFile file
3938 closeHandle file
4039
4140--swiped from System.FileLock package
@@ -84,8 +83,7 @@ openLockFile path =
8483 LockFile <$> P.createFile path ownerWriteMode
8584
8685closeLockFile :: LockFile -> IO ()
87−closeLockFile l@(LockFile fd) = do
88− unlockFile l
86+closeLockFile (LockFile fd) = do
8987 P.closeFd fd
9088
9189--blocks on lock, if necessary
@@ -101,6 +99,6 @@ unlockFile (LockFile fd) =
10199 P.waitToSetLock fd (lockStruct P.Unlock)
102100#endif
103101
104−data LockType = ReadLock | WriteLock
102+data LockType = ReadLock | WriteLock deriving (Show)
105103
106104
src/lib/ProjectM36/TransactionGraph/Persist.hs+1−1
@@ -89,7 +89,7 @@ setupDatabaseDir sync dbdir bootstrapGraph = do
8989 else
9090 pure (Left (InvalidDirectoryError dbdir))
9191{-
92−initialize a database directory with the graph from which to bootstrap- return lock file handle
92+initialize a database directory with the graph from which to bootstrap- return lock file handle which must be closed by the caller
9393-}
9494bootstrapDatabaseDir :: DiskSync -> FilePath -> TransactionGraph -> IO (LockFile, LockFileHash)
9595bootstrapDatabaseDir sync dbdir bootstrapGraph = do