[FFmpeg-devel] default lock mechanism in libavcodec/utils.c

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Feb 19 20:11:35 CET 2014


On Wed, Feb 19, 2014 at 05:09:15PM +0530, anshul wrote:
> On 02/19/2014 04:46 PM, wm4 wrote:
> >This will lead to horrible stuff like library A trying to "unload"
> >libavcodec, while library B is still using it. You can't generally use
> >this function correctly.
> How does that happen "when lib A is loading and lib B is unloading"
> 
> What I understand is follow:
> libavcodec  has been dynamically loaded by libA and libB
> both does not know whether libA or libB  is using libavcodec
> and if libA change some static parameter of libavcodec then libB
> will also see the effect.
> 
> 
> Something I have documented that this is dangerous(unsafe) function
> if it is called when you dont know
> whether any thing is using libavcodec.

And when would you ever know that? Some user on your system might be
using a libc they for fun linked against libavcodec.
IMHO this is an example of an API that, at least strictly speaking,
is _impossible_ to use correctly.
At the very least, you couldn't let anything using this API get
into a Linux distribution unless statically linked (which in turn
would keep it out of many distributions).


More information about the ffmpeg-devel mailing list