[vlc-devel] [RFC-PATCH 04/12] core: introduce input_Decoder{Set, Get}PrerollEnd
Rémi Denis-Courmont
remi at remlab.net
Wed May 11 20:05:28 CEST 2016
On Wednesday 11 May 2016 18:56:49 Filip Roséen wrote:
> These two functions will simply set and get the i_preroll_end
> data-member inside the private section of a decoder.
>
> There are two main reasons for adding them:
>
> 1. The decoders preroll-end value must be reachable from the es-out
> that recieves ES_OUT_SET_NEXT_DISPLAY_TIME.
>
> 2. There are multiple cases in the source code where we have to lock
> the owners lock, read the value, and then immediately unlock the
> mutex. Having helpers will shorten such cases.
This smells fishy. Protecting a single store or a single load with a lock
makes the memory access atomic, but it does not magically make it correct.
The lock means you won´t do undefined memory accesses (in theory), and won´t
get half-updated values (in practice, on 32-bits platforms). The value itself
will still change in fundamentally racy way.
I know the problem predates (by very long) this patch. But at least, it is
currently contained. I don´t think we should expose a fundamentally broken
API.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list