on master help sign in
remove extraneous unlock in closeLockFile
64dfd80AgentM
src/lib/ProjectM36/FileLock.hs+2−4
@@ -35,7 +35,6 @@ openLockFile path = createFile path
35
35
36closeLockFile :: LockFile -> IO ()
36closeLockFile :: LockFile -> IO ()
37closeLockFile file = do
37closeLockFile file = do
38− unlockFile file
39 closeHandle file
38 closeHandle file
40
39
41--swiped from System.FileLock package
40--swiped from System.FileLock package
@@ -84,8 +83,7 @@ openLockFile path =
84 LockFile <$> P.createFile path ownerWriteMode
83 LockFile <$> P.createFile path ownerWriteMode
85
84
86closeLockFile :: LockFile -> IO ()
85closeLockFile :: LockFile -> IO ()
87−closeLockFile l@(LockFile fd) = do
86+closeLockFile (LockFile fd) = do
88− unlockFile l
89 P.closeFd fd
87 P.closeFd fd
90
88
91--blocks on lock, if necessary
89--blocks on lock, if necessary
@@ -101,6 +99,6 @@ unlockFile (LockFile fd) =
101 P.waitToSetLock fd (lockStruct P.Unlock)
99 P.waitToSetLock fd (lockStruct P.Unlock)
102#endif
100#endif
103
101
104−data LockType = ReadLock | WriteLock
102+data LockType = ReadLock | WriteLock deriving (Show)
105
103
106
104
src/lib/ProjectM36/TransactionGraph/Persist.hs+1−1
@@ -89,7 +89,7 @@ setupDatabaseDir sync dbdir bootstrapGraph = do
89 else
89 else
90 pure (Left (InvalidDirectoryError dbdir))
90 pure (Left (InvalidDirectoryError dbdir))
91{-
91{-
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
93-}
93-}
94bootstrapDatabaseDir :: DiskSync -> FilePath -> TransactionGraph -> IO (LockFile, LockFileHash)
94bootstrapDatabaseDir :: DiskSync -> FilePath -> TransactionGraph -> IO (LockFile, LockFileHash)
95bootstrapDatabaseDir sync dbdir bootstrapGraph = do
95bootstrapDatabaseDir sync dbdir bootstrapGraph = do