[vlc-devel] [PATCH 1/6] os2: implement vlc_once()

KO Myung-Hun komh78 at gmail.com
Mon Apr 9 12:27:52 CEST 2018

Rémi Denis-Courmont wrote:
> 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.

vlc_once() is an exported API. So cb() is still opaque.

>>> 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 
> actually happens.

Acquire fence is implied on x86 on which OS/2 runs. Of course, it would
be good to use acquire fence explicitly. However, no problem even if
without it on x86.

Anyway, I already submitted the patch using C11 atomic functions. Review
it, please...


KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

More information about the vlc-devel mailing list