[FFmpeg-devel] [PATCH 1/3] avcodec: add ff_lock/unlock_avcodec functions.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Dec 2 22:06:10 CET 2012


On Sun, Dec 02, 2012 at 09:37:06PM +0100, Michael Niedermayer wrote:
> On Tue, Nov 27, 2012 at 09:59:30PM +0100, Reimar Döffinger wrote:
> > Will be used in future patches, together with the
> > variable that allows checking whether the lock is held.
> 
> cant the code be simplified to avoid 2 variables (ff_avcodec_locked
> and entangled_thread_counter) and use just 1 ?

Yes, it certainly would be easy to use only one.
I just didn't consider it simpler, I consider the
entangled_thread_counter an internal error-checking mechanism and
I don't like the idea of exposing that to other users.
There is also the issue of naming, whichever name I'd chose I think
it would be confusing.
One option I thought about was adding a check_locked function which
does the assert instead so that the entangled_thread_counter could be
used without exposing it, but it seemed a bit like overkill...
But I can do whatever you prefer if that's the only concern.


More information about the ffmpeg-devel mailing list