[vlc-commits] mkv/dispatcher: use vlc::threads

Rémi Denis-Courmont git at videolan.org
Tue Feb 18 19:40:12 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 18 20:23:57 2020 +0200| [c95b99db9871c26ee3895c8f34d388abe3e4c578] | committer: Rémi Denis-Courmont

mkv/dispatcher: use vlc::threads

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c95b99db9871c26ee3895c8f34d388abe3e4c578
---

 modules/demux/mkv/dispatcher.hpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mkv/dispatcher.hpp b/modules/demux/mkv/dispatcher.hpp
index 3058f195e0..cc8ffba799 100644
--- a/modules/demux/mkv/dispatcher.hpp
+++ b/modules/demux/mkv/dispatcher.hpp
@@ -22,6 +22,8 @@
 #ifndef VLC_MKV_DISPATCHER_HPP_
 #define VLC_MKV_DISPATCHER_HPP_
 
+#include <vlc_cxx_helpers.hpp>
+
 // ----------------------------------------------------------------------------
 // This header contains helpers to simulate lambdas in C++03.
 //
@@ -59,14 +61,14 @@ namespace {
   template<class T, class DispatcherType>
   class DispatchContainer {
     public:    static DispatcherType dispatcher;
-    protected: static vlc_mutex_t   _dispatcher_lock;
+    protected: static vlc::threads::mutex _dispatcher_lock;
   };
 
   template<class T, class DT>
   DT DispatchContainer<T, DT>::dispatcher;
 
   template<class T, class DT>
-  vlc_mutex_t DispatchContainer<T, DT>::_dispatcher_lock = VLC_STATIC_MUTEX;
+  vlc::threads::mutex DispatchContainer<T, DT>::_dispatcher_lock;
 }
 
 // ----------------------------------------------------------------------------
@@ -105,13 +107,13 @@ namespace {
 #define MKV_SWITCH_INIT()                     \
   static dispatch_t& Dispatcher () {          \
       static handler_t * p_handler = NULL;    \
-      vlc_mutex_lock( &_dispatcher_lock );    \
+      _dispatcher_lock.lock();                \
       if (unlikely( p_handler == NULL) ) {    \
           static handler_t handler;           \
           p_handler = &handler;               \
           p_handler->dispatcher.on_create (); \
       }                                       \
-      vlc_mutex_unlock( &_dispatcher_lock );  \
+       _dispatcher_lock.unlock();             \
       return p_handler->dispatcher;           \
   } struct PleaseAddSemicolon {}
 



More information about the vlc-commits mailing list