[vlc-devel] [PATCH 2/4] libvlc: media_player: use vlc_atomic_rc for refcount

Alexandre Janniaux ajanni at videolabs.io
Mon Nov 23 10:19:52 CET 2020


Hi,

On Mon, Nov 23, 2020 at 11:13:55AM +0200, Rémi Denis-Courmont wrote:
> Hi,
>
> I don't really the point in using an atomic variable if it can't avoid the
> mutex. Furthermore, using a media player from different threads does not make
> much practical sense. Even if the code is safe against data races, the
> behaviour will be poorly defined if two threads perform different operations
> simultaneously.

Granted for the lock, but it actually protects different things,
so it actually avoid hijacking a lock for a task that don't need
it.

About the media player, this is not about «using» the media player
from different threads, though it might work given it's vlc_player
below, which is designed to be used in a multithread manner, but
I ultimately agree that it makes no sense behaviour wise.

It's about retaining and, probably more importantly, releasing in a
different thread.

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list