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

Steve Lhomme robux4 at gmail.com
Fri Dec 11 11:42:17 CET 2015


I'm spoiled by C++.

On Fri, Dec 11, 2015 at 11:41 AM, Steve Lhomme <robux4 at gmail.com> wrote:
> Doh, you're right... Why does it even work for me ?
>
> On Fri, Dec 11, 2015 at 11:41 AM, Thomas Guillem <thomas at gllm.fr> wrote:
>>
>>
>> On Fri, Dec 11, 2015, at 11:39, Thomas Guillem wrote:
>>>
>>>
>>> On Fri, Dec 11, 2015, at 11:36, Steve Lhomme wrote:
>>> > ---
>>> >  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;
>>>
>>> to atomic_init, atomic_load, or atomic_store ?
>>
>> I mean, you should use atomic_init, atomic_load, and atomic_store.
>>
>>>
>>> >  }
>>> >
>>> >  /*****************************************************************************
>>> > 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
>>> >
>>> > _______________________________________________
>>> > vlc-devel mailing list
>>> > To unsubscribe or modify your subscription options:
>>> > https://mailman.videolan.org/listinfo/vlc-devel
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list