]> git.sesse.net Git - vlc/commitdiff
Gestures: privatize interface callback lock
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 17 Mar 2009 18:50:47 +0000 (20:50 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 17 Mar 2009 18:50:47 +0000 (20:50 +0200)
And hmm, this really should use a condition variable too.

modules/control/gestures.c

index b556bf92aaf341814d22a5628ceb19d8395e8fa0..3d337aeb7e5c0f8eb68cf96320d12a9ad5d8b92e 100644 (file)
@@ -45,6 +45,7 @@
  *****************************************************************************/
 struct intf_sys_t
 {
+    vlc_mutex_t         lock;
     vlc_object_t *      p_vout;
     bool                b_got_gesture;
     bool                b_button_pressed;
@@ -119,6 +120,7 @@ int Open ( vlc_object_t *p_this )
     // Configure the module
     p_intf->pf_run = RunIntf;
 
+    vlc_mutex_init( &p_sys->lock );
     p_sys->p_vout = NULL;
     p_sys->b_got_gesture = false;
     p_sys->b_button_pressed = false;
@@ -166,6 +168,7 @@ void Close ( vlc_object_t *p_this )
     }
 
     /* Destroy structure */
+    vlc_mutex_destroy( &p_intf->p_sys->lock );
     free( p_intf->p_sys );
 }
 
@@ -182,7 +185,7 @@ static void RunIntf( intf_thread_t *p_intf )
     /* Main loop */
     while( vlc_object_alive( p_intf ) )
     {
-        vlc_mutex_lock( &p_intf->change_lock );
+        vlc_mutex_lock( &p_intf->p_sys->lock );
 
         /*
          * mouse cursor
@@ -443,7 +446,7 @@ static void RunIntf( intf_thread_t *p_intf )
             }
         }
 
-        vlc_mutex_unlock( &p_intf->change_lock );
+        vlc_mutex_unlock( &p_intf->p_sys->lock );
 
         /* Wait a bit */
         msleep( INTF_IDLE_SLEEP );
@@ -465,12 +468,12 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var,
     signed int i_horizontal, i_vertical;
     intf_thread_t *p_intf = (intf_thread_t *)p_data;
 
-    vlc_mutex_lock( &p_intf->change_lock );
+    vlc_mutex_lock( &p_intf->p_sys->lock );
 
     /* don't process new gestures before the last events are processed */
     if( p_intf->p_sys->b_got_gesture )
     {
-        vlc_mutex_unlock( &p_intf->change_lock );
+        vlc_mutex_unlock( &p_intf->p_sys->lock );
         return VLC_SUCCESS;
     }
 
@@ -539,7 +542,7 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var,
         p_intf->p_sys->b_got_gesture = true;
     }
 
-    vlc_mutex_unlock( &p_intf->change_lock );
+    vlc_mutex_unlock( &p_intf->p_sys->lock );
 
     return VLC_SUCCESS;
 }