[vlc-devel] commit: skins2: lock needed for updating the async queue ( multi-treaded context) (Erwan Tulou )

git version control git at videolan.org
Mon Aug 24 18:07:58 CEST 2009


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Aug 22 14:56:55 2009 +0200| [9ad7729f1eb6cdf4fd393a922ae53fbe00c9b061] | committer: Erwan Tulou 

skins2: lock needed for updating the async queue (multi-treaded context)

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

 modules/gui/skins2/commands/async_queue.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/skins2/commands/async_queue.cpp b/modules/gui/skins2/commands/async_queue.cpp
index e2fcbac..bd7a071 100644
--- a/modules/gui/skins2/commands/async_queue.cpp
+++ b/modules/gui/skins2/commands/async_queue.cpp
@@ -74,19 +74,21 @@ void AsyncQueue::destroy( intf_thread_t *pIntf )
 
 void AsyncQueue::push( const CmdGenericPtr &rcCommand, bool removePrev )
 {
+    vlc_mutex_lock( &m_lock );
+
     if( removePrev )
     {
         // Remove the commands of the same type
         remove( rcCommand.get()->getType(), rcCommand );
     }
     m_cmdList.push_back( rcCommand );
+
+    vlc_mutex_unlock( &m_lock );
 }
 
 
 void AsyncQueue::remove( const string &rType, const CmdGenericPtr &rcCommand )
 {
-    vlc_mutex_lock( &m_lock );
-
     list<CmdGenericPtr>::iterator it;
     for( it = m_cmdList.begin(); it != m_cmdList.end(); it++ )
     {
@@ -104,8 +106,6 @@ void AsyncQueue::remove( const string &rType, const CmdGenericPtr &rcCommand )
             }
         }
     }
-
-    vlc_mutex_unlock( &m_lock );
 }
 
 




More information about the vlc-devel mailing list