aboutsummaryrefslogtreecommitdiff
path: root/bpkg/database.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-15 11:04:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-15 11:04:12 +0200
commit848eeec75dd90c2da404f223e6534c701f11fe56 (patch)
tree575a920d70d36b1261c3340e2bb3d0fc9a717b50 /bpkg/database.cxx
parent333c5953151d6324d83d279a7ac3c53cd1af54b9 (diff)
Diagnose database locking
Diffstat (limited to 'bpkg/database.cxx')
-rw-r--r--bpkg/database.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/bpkg/database.cxx b/bpkg/database.cxx
index 3488fa1..1bfe9b9 100644
--- a/bpkg/database.cxx
+++ b/bpkg/database.cxx
@@ -49,11 +49,16 @@ namespace bpkg
// also fail if the database is inaccessible (e.g., file does not
// exist, already used by another process, etc).
//
+ try
{
db.connection ()->execute ("PRAGMA locking_mode = EXCLUSIVE");
transaction t (db.begin_exclusive ());
t.commit ();
}
+ catch (odb::timeout&)
+ {
+ fail << "configuration " << d << " is already used by another process";
+ }
if (create)
{