[coldfire-gnu-discuss] Making malloc threadsafe

Daniel McLean daniel.mclean at optusnet.com.au
Mon Mar 12 04:29:10 UTC 2007


Hi Carlos,

I'm using the ELF compiler.  I'm running the on a small RTOS 
(www.freeRTOS.org), as opposed to Linux...

Thanks
Daniel

Carlos O'Donell wrote:
> On Mon, Mar 12, 2007 at 12:22:49PM +1000, Daniel McLean wrote:
>   
>> I was just wondering if it is possible to make malloc thread safe with 
>> Sourcery G++ Lite?  It seems that libc defines _malloc_lock and 
>> _malloc_unlock already.  If I make sure that all my calls to malloc in 
>> my code are thread safe (using mutual exclusion) will this ensure that 
>> memory allocation is in fact thread safe? Or are there places that 
>> malloc is called inside the C library such that without implementing 
>> _malloc_lock and _malloc_unlock malloc it won't be thread safe?
>>
>> If so how can I make sure that malloc is thread safe? 
>>     
>
> Which targets are you using? Coldfire GNU/Linux, Coldfire uCLinux?
>
> Cheers,
> Carlos.
>   




More information about the coldfire-gnu-discuss mailing list