[vlc-devel] [PATCH] input: reduce the number of locks for every MainLoop cycle

Steve Lhomme robux4 at videolabs.io
Fri Dec 11 11:36:08 CET 2015


---
 src/input/input.c          | 7 +------
 src/input/input_internal.h | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index a5d408c..a982fa7 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -510,12 +510,7 @@ static void *Preparse( void *obj )
 bool input_Stopped( input_thread_t *input )
 {
     input_thread_private_t *sys = input->p;
-    bool ret;
-
-    vlc_mutex_lock( &sys->lock_control );
-    ret = sys->is_stopped;
-    vlc_mutex_unlock( &sys->lock_control );
-    return ret;
+    return sys->is_stopped;
 }
 
 /*****************************************************************************
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 249ef2e..1d35d94 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -89,7 +89,7 @@ struct input_thread_private_t
     /* Current state */
     int         i_state;
     bool        is_running;
-    bool        is_stopped;
+    atomic_bool is_stopped;
     bool        b_recording;
     int         i_rate;
 
-- 
2.6.3



More information about the vlc-devel mailing list