comp.lang.c
[Top] [All Lists]

Re: Reentrant functions and memory allocation

Subject: Re: Reentrant functions and memory allocation
From: Flash Gordon
Date: Sun, 30 Mar 2008 14:08:42 +0100
Newsgroups: comp.lang.c


fmassei@xxxxxxxxx wrote, On 30/03/08 13:45:
Dear all,
I'm trying to put some old code in a portable, cross-platform library
and I'm facing a big problem: is there a standard, platform-
independent way to write a reentrant function that allocate dynamic
memory? In other words: is it safe to use malloc() or free() in a
thread-safe function?

Re-entrancy and thread safety are not the same. The C standard does not know about threads but does know a little about reentrancy, and malloc/realloc/free are not required to be reentrant. You might find comp.programming.threads a better place to ask about how you can solve your threading problems.
--
Flash Gordon

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy