From 0240e75426f483ff558422f99e29708e3f31fdb7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 5 Sep 2012 20:50:15 +0200 Subject: db_lock: add C++ helper class ScopeDatabaseLock --- src/db_lock.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/db_lock.h') 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 -- cgit v1.2.3