<p dir="ltr">On 15 May 2013 19:13, "Joe Flowers" <<a href="mailto:joe.flowers@nofreewill.com">joe.flowers@nofreewill.com</a>> wrote:<br>
><br>
> Carl and Hendrik,<br>
><br>
> Thank you very much for your comments and expertise.  <br>
><br>
> You are right, I'm mixing up thread-safety and re-entrantcy.  Sorry.<br>
><br>
> With Hendrik's advice on not cancelling threads to prevent a deadlock or zombie-type threads, I'm now more concerned with thread-safeness.<br>
><br>
> 1.<br>
> I know when I configure and make FFMPEG, there is an "--enable-pthreads" option. If I am understanding things correctly, this particular option is not relevant to the thread safety of a C program calling the libav* APIs, correct?</p>

<p dir="ltr">Some codecs allow multithreaded processing to speed things up (on multicore systems). That's where pthreads become relevant.</p>
<p dir="ltr">> 2.<br>
> I am using gcc on Ubuntu to compile and link to the libav* libraries and am wondering if I need to use a particular "-pthreads" option (or something else) with gcc to make sure I am using thread-safe C libraries to get a thread-safe malloc()?</p>

<p dir="ltr">In your toolchain, malloc is thread-safe.</p>
<p dir="ltr">>   The reason I ask is because in Windoze one has to link with the mulithreaded C libraries (*MT.lib) to get a thread-safe version of malloc().</p>
<p dir="ltr">Non-multithread RT libraries for Microsoft C compiler are long gone.</p>
<p dir="ltr">BR<br>
Alex</p>