diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-15 11:04:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-15 11:04:12 +0200 |
commit | 848eeec75dd90c2da404f223e6534c701f11fe56 (patch) | |
tree | 575a920d70d36b1261c3340e2bb3d0fc9a717b50 | |
parent | 333c5953151d6324d83d279a7ac3c53cd1af54b9 (diff) |
Diagnose database locking
-rw-r--r-- | bpkg/database.cxx | 5 |
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) { |