Redlib malloc - thread safe?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by jharwood on Tue Apr 26 12:30:28 MST 2011
I would like to use the stdlib functions malloc and friends, printf and friends in a RTOS environment.

It appears that malloc is not thread safe, I tried declaring a function
void __malloc_lock(void)
but it was not called. I also stepped through the malloc code to see if there were any 'cpsie i' and 'cpsid i' instructions in there.

So I guess that I have to wrap every call to the standard library functions with the appropriate OS guard calls.

Is there any possibility that the __malloc_lock and __malloc_unlock stubs could be added to the Redlib library?