db/DatabaseLock: add class ScopeDatabaseUnlock

This commit is contained in:
Max Kellermann
2015-12-15 23:24:34 +01:00
parent e31f0b8b0c
commit c11345c4d9
3 changed files with 22 additions and 11 deletions

View File

@@ -107,4 +107,18 @@ public:
}
};
/**
* Unlock the database while in the current scope.
*/
class ScopeDatabaseUnlock {
public:
ScopeDatabaseUnlock() {
db_unlock();
}
~ScopeDatabaseUnlock() {
db_lock();
}
};
#endif