On Wed, May 15, 2013 at 5:37 PM, Carl Eugen Hoyos <[email protected]> wrote:
> Joe Flowers <joe.flowers@...> writes:
>
>> I need to use the libav* APIs (specifically the audio
>> codecs) in a thread-safe way, but they seem to be full
>> of malloc()s and free()s which aren't re-entrant.
>
> My malloc manual says that it uses mutexes "internally to
> protect the memory-management data structures employed by
> these functions" (alloc, free, etc.) to avoid corruption.
> Or do I miss something?
>

Using mutexes is not reentrant, however that has nothing to do with
thread-safety.
malloc is thread-safe, but not reentrant.

That means you can use it just fine multi-threaded, however you could
deadlock if you somehow cancel a thread thats inside a malloc right
now (meaning the mutex is never unlocked)
Canceling threads like that should generally be avoided, and at least
the libav* libraries don't do it themself.
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to