summaryrefslogtreecommitdiff
path: root/Annex/Journal.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-28 14:17:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-28 14:42:03 -0400
commite48f551505b3923d7c17e3b42330060e84129673 (patch)
tree5de335f5cc25b39a5d4ca12fdb6a076e03cf34db /Annex/Journal.hs
parent4a923c3ee0e238ccc17881179bec77c6531e3ad4 (diff)
use locking on Windows
This is all the easy cases, where there was already a separate lock file.
Diffstat (limited to 'Annex/Journal.hs')
-rw-r--r--Annex/Journal.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/Annex/Journal.hs b/Annex/Journal.hs
index 8b88ab2fb..3f31cb941 100644
--- a/Annex/Journal.hs
+++ b/Annex/Journal.hs
@@ -20,6 +20,10 @@ import Annex.Exception
import qualified Git
import Annex.Perms
+#ifdef mingw32_HOST_OS
+import Utility.WinLock
+#endif
+
{- Records content for a file in the branch to the journal.
-
- Using the journal, rather than immediatly staging content to the index
@@ -116,13 +120,8 @@ lockJournal a = do
l <- noUmask mode $ createFile lockfile mode
waitToSetLock l (WriteLock, AbsoluteSeek, 0, 0)
return l
-#else
- lock lockfile _mode = do
- writeFile lockfile ""
- return lockfile
-#endif
-#ifndef mingw32_HOST_OS
unlock = closeFd
#else
- unlock = removeFile
+ lock lockfile _mode = waitToLock $ lockExclusive lockfile
+ unlock = dropLock
#endif