[FFmpeg-devel] default lock mechanism in libavcodec/utils.c
anshul
anshul.ffmpeg at gmail.com
Thu Feb 20 10:50:24 CET 2014
On 02/20/2014 02:01 PM, wm4 wrote:
> On Thu, 20 Feb 2014 13:27:28 +0530
> anshul <anshul.ffmpeg at gmail.com> wrote:
>
>> There was an another idea of michael that using reference count,
>> Reimar Döffinger if you want reference count then you can help me over
>> there by some guideline, I have not implemented that idea because if i
>> miss an reference count then that bug would take more time
>> to solve.
> Reference counting? This is just awful. How are you going to
> synchronize initialization and reference counting if you have no lock
> that you could use?
>
> Let me repeat: global library initialization functions are broken by
> design, and global library uninitialization functions are even more
> broken. If a library has static data that must be initialized once, it
> should use pthread_once() to synchronize this initialization.
>
> (Does this bizarre lock manager stuff even synchronize initialization?
> I think it does after recent changes, but it's still a very bad
> emulation of pthread_once().)
>
> By the way, it seems this function can be used to implement
> pthread_once on windows:
>
> http://msdn.microsoft.com/en-us/library/ms683493(v=vs.85).aspx
>
> But it seems it's not supported on XP, and I'm not sure how to do it on
> OS/2.
>
>> just now i am following below idea:
>>
>> some code that gets called on exit or
>> lib unloading by the OS.
> Using atexit()? Might work...
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Hi
I agree with you but to use pthread_once and at_exit, we need to have
some mechanism that
would create lock and destroy lock, so the patch that I offered was step
toward that.
Thanks
Anshul
More information about the ffmpeg-devel
mailing list