aboutsummaryrefslogtreecommitdiffstats
path: root/src/db_lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/db_lock.h')
-rw-r--r--src/db_lock.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/db_lock.h b/src/db_lock.h
index 4640502f3..eed71eec0 100644
--- a/src/db_lock.h
+++ b/src/db_lock.h
@@ -81,4 +81,19 @@ db_unlock(void)
g_static_mutex_unlock(&db_mutex);
}
+#ifdef __cplusplus
+
+class ScopeDatabaseLock {
+public:
+ ScopeDatabaseLock() {
+ db_lock();
+ }
+
+ ~ScopeDatabaseLock() {
+ db_unlock();
+ }
+};
+
+#endif
+
#endif