[vlc-commits] lua: PushCommand: Reduce locked scope

Hugo Beauzée-Luyssen git at videolan.org
Thu Mar 30 13:56:32 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Mar 28 16:03:30 2017 +0200| [ce74108099be33c6d0355b8fabfaa1f424b8b13b] | committer: Hugo Beauzée-Luyssen

lua: PushCommand: Reduce locked scope

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

 modules/lua/extension_thread.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/modules/lua/extension_thread.c b/modules/lua/extension_thread.c
index 5c18373..f3e9ca9 100644
--- a/modules/lua/extension_thread.c
+++ b/modules/lua/extension_thread.c
@@ -228,8 +228,6 @@ void KillExtension( extensions_manager_t *p_mgr, extension_t *p_ext )
 int PushCommand__( extension_t *p_ext,  bool b_unique, command_type_e i_command,
                    va_list args )
 {
-    vlc_mutex_lock( &p_ext->p_sys->command_lock );
-
     /* Create command */
     struct command_t *cmd = calloc( 1, sizeof( struct command_t ) );
     cmd->i_command = i_command;
@@ -244,7 +242,6 @@ int PushCommand__( extension_t *p_ext,  bool b_unique, command_type_e i_command,
                 if( !pi )
                 {
                     free( cmd );
-                    vlc_mutex_unlock( &p_ext->p_sys->command_lock );
                     return VLC_ENOMEM;
                 }
                 *pi = va_arg( args, int );
@@ -257,7 +254,6 @@ int PushCommand__( extension_t *p_ext,  bool b_unique, command_type_e i_command,
                 if( !pi )
                 {
                     free( cmd );
-                    vlc_mutex_unlock( &p_ext->p_sys->command_lock );
                     return VLC_ENOMEM;
                 }
                 *pi = va_arg( args, int );
@@ -275,6 +271,8 @@ int PushCommand__( extension_t *p_ext,  bool b_unique, command_type_e i_command,
             break;
     }
 
+    vlc_mutex_lock( &p_ext->p_sys->command_lock );
+
     /* Push command to the end of the queue */
     struct command_t *last = p_ext->p_sys->command;
     if( !last )



More information about the vlc-commits mailing list