Commit 888f4987 authored by Erwan Tulou's avatar Erwan Tulou

skins2: use of vlc_mutex_locker simplifies things a bit

pointed out by courmish
parent 2c45bce6
...@@ -91,12 +91,11 @@ public: ...@@ -91,12 +91,11 @@ public:
static void executeWait( const CmdGenericPtr& rcCommand ) static void executeWait( const CmdGenericPtr& rcCommand )
{ {
CmdExecuteBlock& rCmd = (CmdExecuteBlock&)*rcCommand.get(); 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 ) if( !rCmd.m_pObj || !rCmd.m_pfFunc || rCmd.m_executing )
{ {
msg_Err( rCmd.getIntf(), "unexpected command call" ); msg_Err( rCmd.getIntf(), "unexpected command call" );
vlc_mutex_unlock( &rCmd.m_lock );
return; return;
} }
...@@ -106,25 +105,21 @@ public: ...@@ -106,25 +105,21 @@ public:
rCmd.m_executing = true; rCmd.m_executing = true;
while( rCmd.m_executing ) while( rCmd.m_executing )
vlc_cond_wait( &rCmd.m_wait, &rCmd.m_lock ); vlc_cond_wait( &rCmd.m_wait, &rCmd.m_lock );
vlc_mutex_unlock( &rCmd.m_lock );
} }
virtual void execute() virtual void execute()
{ {
vlc_mutex_lock( &m_lock ); vlc_mutex_locker locker( &m_lock );
if( !m_pObj || !m_pfFunc || !m_executing ) if( !m_pObj || !m_pfFunc || !m_executing )
{ {
msg_Err( getIntf(), "unexpected command call" ); msg_Err( getIntf(), "unexpected command call" );
vlc_mutex_unlock( &m_lock );
return; return;
} }
(*m_pfFunc)( getIntf(), m_pObj ); (*m_pfFunc)( getIntf(), m_pObj );
m_executing = false; m_executing = false;
vlc_cond_signal( &m_wait ); vlc_cond_signal( &m_wait );
vlc_mutex_unlock( &m_lock );
} }
virtual string getType() const { return "CmdExecuteBlock"; } virtual string getType() const { return "CmdExecuteBlock"; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment