[vlc-commits] lua: remove cargo-cultivated cancellation

Rémi Denis-Courmont git at videolan.org
Fri Nov 18 23:27:45 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 19 00:26:02 2016 +0200| [7a94f2e6b22bad255ddcca6e095ed33bc4803e45] | committer: Rémi Denis-Courmont

lua: remove cargo-cultivated cancellation

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

 modules/lua/extension.c        | 6 +++---
 modules/lua/extension_thread.c | 9 ++-------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 32009cc..92c2eb7 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -1223,8 +1223,8 @@ static void WatchTimerCallback( void *data )
                 vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
                 p_ext->p_sys->p_progress_id = NULL;
             }
-            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             KillExtension( p_mgr, p_ext );
+            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             return;
         }
 
@@ -1239,8 +1239,8 @@ static void WatchTimerCallback( void *data )
                                          p_ext->psz_title );
         if( p_ext->p_sys->p_progress_id == NULL )
         {
-            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             KillExtension( p_mgr, p_ext );
+            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             return;
         }
         vlc_timer_schedule( p_ext->p_sys->timer, false, 100000, 0 );
@@ -1251,8 +1251,8 @@ static void WatchTimerCallback( void *data )
         {
             vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
             p_ext->p_sys->p_progress_id = NULL;
-            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             KillExtension( p_mgr, p_ext );
+            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             return;
         }
         vlc_timer_schedule( p_ext->p_sys->timer, false, 100000, 0 );
diff --git a/modules/lua/extension_thread.c b/modules/lua/extension_thread.c
index a345b26..affa659 100644
--- a/modules/lua/extension_thread.c
+++ b/modules/lua/extension_thread.c
@@ -153,8 +153,8 @@ int Deactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
         // Extension is stuck, kill it now
         vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
         p_ext->p_sys->p_progress_id = NULL;
-        vlc_mutex_unlock( &p_ext->p_sys->command_lock );
         KillExtension( p_mgr, p_ext );
+        vlc_mutex_unlock( &p_ext->p_sys->command_lock );
         return VLC_SUCCESS;
     }
 
@@ -215,11 +215,10 @@ static int RemoveActivated( extensions_manager_t *p_mgr, extension_t *p_ext )
 
 void KillExtension( extensions_manager_t *p_mgr, extension_t *p_ext )
 {
-    /* Cancel thread if it seems stuck for a while */
     msg_Dbg( p_mgr, "Killing extension now" );
-    vlc_cancel( p_ext->p_sys->thread );
     lua_ExtensionDeactivate( p_mgr, p_ext );
     p_ext->p_sys->b_exiting = true;
+    vlc_cond_signal( &p_ext->p_sys->wait );
     RemoveActivated( p_mgr, p_ext );
 }
 
@@ -318,7 +317,6 @@ static void* Run( void *data )
     extensions_manager_t *p_mgr = p_ext->p_sys->p_mgr;
 
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
-    mutex_cleanup_push( &p_ext->p_sys->command_lock );
 
     while( !p_ext->p_sys->b_exiting )
     {
@@ -336,7 +334,6 @@ static void* Run( void *data )
         vlc_mutex_unlock( &p_ext->p_sys->command_lock );
 
         /* Run command */
-        int cancel = vlc_savecancel();
         if( LockExtension( p_ext ) )
         {
             switch( cmd->i_command )
@@ -423,11 +420,9 @@ static void* Run( void *data )
         }
         FreeCommands( cmd );
 
-        vlc_restorecancel( cancel );
         vlc_mutex_lock( &p_ext->p_sys->command_lock );
     }
 
-    vlc_cleanup_pop( );
     vlc_mutex_unlock( &p_ext->p_sys->command_lock );
     msg_Dbg( p_mgr, "Extension thread end: '%s'", p_ext->psz_title );
 



More information about the vlc-commits mailing list