diff options
Diffstat (limited to '')
-rw-r--r-- | src/DatabaseLock.hxx (renamed from src/db_lock.h) | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/db_lock.h b/src/DatabaseLock.hxx index 4640502f3..6646fb43d 100644 --- a/src/db_lock.h +++ b/src/DatabaseLock.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,14 +23,13 @@ * multi-threading. */ -#ifndef MPD_DB_LOCK_H -#define MPD_DB_LOCK_H +#ifndef MPD_DB_LOCK_HXX +#define MPD_DB_LOCK_HXX #include "check.h" #include <glib.h> #include <assert.h> -#include <stdbool.h> extern GStaticMutex db_mutex; @@ -81,4 +80,19 @@ db_unlock(void) g_static_mutex_unlock(&db_mutex); } +#ifdef __cplusplus + +class ScopeDatabaseLock { +public: + ScopeDatabaseLock() { + db_lock(); + } + + ~ScopeDatabaseLock() { + db_unlock(); + } +}; + +#endif + #endif |