[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:17:24 CEST 2016


On Wednesday 11 May 2016 20:09:34 Filip Roséen wrote:
> > 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.
> 
> Very much agreed! There is an "TODO" attached to the associated message when
> sending the patch to the mailing-list:
> 
>     TODO: Instead of locking/unlocking the mutex each time we are interested
> in reading/writing the value, we should use an atomic variable.

That´s completely missing the point. An atomic variable would have the exact 
same fundamental timing issues as a variable with a mutex.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list