diff options
author | Max Kellermann <max@duempel.org> | 2012-09-05 20:50:15 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-09-05 20:52:02 +0200 |
commit | 0240e75426f483ff558422f99e29708e3f31fdb7 (patch) | |
tree | 29e11cef619d041210393ae1bcf03901b1d4e570 /src/db_lock.h | |
parent | 7102ed802638e31f8a8391b51a2989cd087748d1 (diff) | |
download | mpd-0240e75426f483ff558422f99e29708e3f31fdb7.tar.gz mpd-0240e75426f483ff558422f99e29708e3f31fdb7.tar.xz mpd-0240e75426f483ff558422f99e29708e3f31fdb7.zip |
db_lock: add C++ helper class ScopeDatabaseLock
Diffstat (limited to '')
-rw-r--r-- | src/db_lock.h | 15 |
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 |