aboutsummaryrefslogtreecommitdiff
path: root/Database
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-16 13:24:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-16 13:24:45 -0400
commit9760673f5e76757714f4b7bd185ef41a3d649e7f (patch)
tree700e466e59c02f2dd5d1d341b2559240fc8c96e9 /Database
parent747caa452a29a38bb8f02a0efaf47fb80a92bf6d (diff)
comment
Diffstat (limited to 'Database')
-rw-r--r--Database/Keys.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Database/Keys.hs b/Database/Keys.hs
index 62c7c25eb..d4b5b3357 100644
--- a/Database/Keys.hs
+++ b/Database/Keys.hs
@@ -54,7 +54,14 @@ Content
KeyCacheIndex key cache
|]
-{- Opens the database, creating it if it doesn't exist yet. -}
+{- Opens the database, creating it if it doesn't exist yet.
+ -
+ - Multiple readers and writers can have the database open at the same
+ - time. Database.Handle deals with the concurrency issues.
+ - The lock is held while opening the database, so that when
+ - the database doesn't exist yet, one caller wins the lock and
+ - can create it undisturbed.
+ -}
openDb :: Annex DbHandle
openDb = withExclusiveLock gitAnnexKeysDbLock $ do
dbdir <- fromRepo gitAnnexKeysDb