[vlc-commits] commit: skins2: use of vlc_mutex_locker simplifies things a bit ( Erwan Tulou )

git at videolan.org git at videolan.org
Wed Jan 12 19:03:37 CET 2011


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Jan 12 18:33:56 2011 +0100| [888f4987ea2970f908270791da99d51a3753a23d] | committer: Erwan Tulou 

skins2: use of vlc_mutex_locker simplifies things a bit

pointed out by courmish

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

 modules/gui/skins2/commands/cmd_callbacks.hpp |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/commands/cmd_callbacks.hpp b/modules/gui/skins2/commands/cmd_callbacks.hpp
index 32ba450..76cf23d 100644
--- a/modules/gui/skins2/commands/cmd_callbacks.hpp
+++ b/modules/gui/skins2/commands/cmd_callbacks.hpp
@@ -91,12 +91,11 @@ public:
     static void executeWait( const CmdGenericPtr& rcCommand  )
     {
         CmdExecuteBlock& rCmd = (CmdExecuteBlock&)*rcCommand.get();
-        vlc_mutex_lock( &rCmd.m_lock );
+        vlc_mutex_locker locker( &rCmd.m_lock );
 
         if( !rCmd.m_pObj || !rCmd.m_pfFunc || rCmd.m_executing )
         {
             msg_Err( rCmd.getIntf(), "unexpected command call" );
-            vlc_mutex_unlock( &rCmd.m_lock );
             return;
         }
 
@@ -106,25 +105,21 @@ public:
         rCmd.m_executing = true;
         while( rCmd.m_executing )
             vlc_cond_wait( &rCmd.m_wait, &rCmd.m_lock );
-
-        vlc_mutex_unlock( &rCmd.m_lock );
     }
 
     virtual void execute()
     {
-        vlc_mutex_lock( &m_lock );
+        vlc_mutex_locker locker( &m_lock );
 
         if( !m_pObj || !m_pfFunc || !m_executing )
         {
             msg_Err( getIntf(), "unexpected command call" );
-            vlc_mutex_unlock( &m_lock );
             return;
         }
 
         (*m_pfFunc)( getIntf(), m_pObj );
         m_executing = false;
         vlc_cond_signal( &m_wait );
-        vlc_mutex_unlock( &m_lock );
     }
 
     virtual string getType() const { return "CmdExecuteBlock"; }



More information about the vlc-commits mailing list