[vlc-devel] [PATCH 1/6] os2: implement vlc_once()
remi at remlab.net
Sun Apr 8 09:40:25 CEST 2018
Le sunnuntaina 8. huhtikuuta 2018, 10.01.32 EEST KO Myung-Hun a écrit :
> >> And compiler cannot see the internal of cb().
> > With LTO and IPA combined, a compiler can propagate vlc_CPU_init as the cb
> > value into vlc_once() from vlc_CPU().
> Then, are you saying that with them, compiler can reorder a call to
> function pointer and others ?
The compiler can do *anything* as long as it does not contradict the
observable side effects.
> > Not that it matters much. The problem is not a lack of release fence.
> > Unlocking the mutex provides a release fence. The problem is the lack fo
> > acquire fence before reading the flag.
> I'm saying that acquire fence is not necessary in this case, especially
> on x86 because x86 guarantees "Writes by a single processor are observed
> in the same order by all processors" in Intel Manual Vol 3A 8.2.2.
You still need a compiler-level acquire fence to ensure the load instruction
More information about the vlc-devel