[vlc-devel] [PATCH] HLS: remove some useless mutex locks

Frederic YHUEL fyhuel at viotech.net
Tue Feb 7 17:33:50 CET 2012


2012/2/7 Rémi Denis-Courmont <remi at remlab.net>:
> Le mardi 7 février 2012 16:26:26 Hugo Beauzée-Luyssen, vous avez écrit :
>> 2012/2/7 Frédéric Yhuel <fyhuel at viotech.net>:
>> > ---
>> >  modules/stream_filter/httplive.c |    4 ----
>> >  1 files changed, 0 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/modules/stream_filter/httplive.c
>> > b/modules/stream_filter/httplive.c index c03061b..9afd5c0 100644
>> > --- a/modules/stream_filter/httplive.c
>> > +++ b/modules/stream_filter/httplive.c
>> > @@ -2070,9 +2070,7 @@ static void Close(vlc_object_t *p_this)
>> >     assert(p_sys->hls_stream);
>> >
>> >     /* */
>> > -    vlc_mutex_lock(&p_sys->download.lock_wait);
>> >     vlc_cond_signal(&p_sys->download.wait);
>> > -    vlc_mutex_unlock(&p_sys->download.lock_wait);
>>
>> This mutex isn't useless, if you don't hold it before calling
>> vlc_cond_signal there is no way of being sure the thread is actually
>> waiting.
>
> The code is wrong EITHER way.
>
> Calling vlc_cond_signal() out of the blue makes no sense.
>

Hi Rémi,

Out of the blue?

Do you mean that we should maintain the state (ALIVE | WAITING |
TERMINATED ) of the downloading thread in a shared variable, and that
we should call vlc_cond_signal() only after having checked the state?

-- 
Frédéric



More information about the vlc-devel mailing list