[Android] medialibrary: DeviceLister: Make the mutex a member variable

Hugo Beauzée-Luyssen git at videolan.org
Thu Dec 15 10:17:54 CET 2016


vlc-android | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 15 10:02:40 2016 +0100| [e0aa9523d8115451e80a8189fdbc9275a664c434] | committer: Geoffrey Métais

medialibrary: DeviceLister: Make the mutex a member variable

> https://code.videolan.org/videolan/vlc-android/commit/e0aa9523d8115451e80a8189fdbc9275a664c434
---

 medialibrary/jni/AndroidDeviceLister.cpp | 4 ----
 medialibrary/jni/AndroidDeviceLister.h   | 5 ++++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/medialibrary/jni/AndroidDeviceLister.cpp b/medialibrary/jni/AndroidDeviceLister.cpp
index 4241b76..1103fdb 100644
--- a/medialibrary/jni/AndroidDeviceLister.cpp
+++ b/medialibrary/jni/AndroidDeviceLister.cpp
@@ -1,12 +1,8 @@
 #include "AndroidDeviceLister.h"
 
-#include <mutex>
-
 #define LOG_TAG "VLC/JNI/AndroidDeviceLister"
 #include "log.h"
 
-static std::mutex m_mutex;
-
 AndroidDeviceLister::AndroidDeviceLister()
 {
 }
diff --git a/medialibrary/jni/AndroidDeviceLister.h b/medialibrary/jni/AndroidDeviceLister.h
index 675b4b6..a36790e 100644
--- a/medialibrary/jni/AndroidDeviceLister.h
+++ b/medialibrary/jni/AndroidDeviceLister.h
@@ -5,7 +5,7 @@
 #include <string>
 #include <vector>
 #include <unordered_map>
-
+#include <mutex>
 
 class AndroidDeviceLister : public medialibrary::IDeviceLister
 {
@@ -17,6 +17,9 @@ public:
 
 private:
     std::unordered_map<std::string, std::tuple<std::string, std::string, bool>> m_devices;
+
+private:
+    mutable std::mutex m_mutex;
 };
 
 #endif // ANDROIDDEVICELISTER_H



More information about the Android mailing list