Commit 7dd3b72a authored by Max Kellermann's avatar Max Kellermann

db/DatabaseLock: add ScopeDatabaseLock::unlock()

parent aeccccb3
......@@ -84,13 +84,26 @@ db_unlock(void)
}
class ScopeDatabaseLock {
bool locked = true;
public:
ScopeDatabaseLock() {
db_lock();
}
~ScopeDatabaseLock() {
if (locked)
db_unlock();
}
/**
* Unlock the mutex now, making the destructor a no-op.
*/
void unlock() {
assert(locked);
db_unlock();
locked = false;
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment