[vlc-devel] [PATCH 2/2] avcodec: protect the flush call

Rémi Denis-Courmont remi at remlab.net
Tue Sep 24 11:07:03 CEST 2019


Hi,

Maybe, haven't checked.

If the lock is always acquired and released in the same call, it can be converted to mutex. But if a function can acquire the lock, then return without releasing, then it probably must remain a semaphore 

Le 24 septembre 2019 10:41:19 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>On 2019-09-23 18:25, Rémi Denis-Courmont wrote:
>> Hi,
>> 
>> I don't know exactly what synchronisation was needed then and now for
>avcodec per se, as opposed to what Laurent did for old VLC core or just
>out of uncertainty.
>> 
>> But there is one difference between a semaphore lock and a mutex
>lock. The earlier can be released from a different thread than the one
>which acquired it. The splitter uses semaphores for that reason: it
>cannot assume that the releasing thread is the acquiring thread.
>
>I think in the case of lavc it's only used to protect some variables 
>between the lavc decoder thread(s) and VLC decoder/input thread, not to
>
>adjust the order in which threads are allowed to run.
>
>> Le 23 septembre 2019 13:49:14 GMT+03:00, Francois Cartegnie
><fcvlcdev at free.fr> a écrit :
>>> Le 23/09/2019 à 10:51, Thomas Guillem a écrit :
>>>> It's just a 0/1 semaphore. I don't really know why we use a
>semaphore
>>> here instead of a mutex.
>>>>
>>>
>>> Dates from early avcodec threading.
>>> The usual comment is : is that still needed ?
>>>
>>> -- 
>>> Francois Cartegnie
>>> VideoLAN - VLC Developer
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> 
>> -- 
>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
>excuser ma brièveté.
>> 
>> 
>> _______________________________________________
>> 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

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190924/af9af68c/attachment.html>


More information about the vlc-devel mailing list