climber.cui@[EMAIL PROTECTED]
wrote:
> Hi all,
> Does anyone have experience on the thread-safty issue with malloc()?
On any *reasonable* implementation sup****ting threads, malloc
is thread safe, all provided you link with the proper library.
> Some people said this function provided in stdlib.h is not thread-
> safe, but someone said it is thread safe. Is it possible this
> function evolves from thread-unsafe to thread-safe in recent years?
Hardly. Having threads but a non-thread-safe version of malloc() isn't
going to be helpful.
> How could i find out?
Study your compiler manual. ANSI-C doesn't say anything about threads,
it's a POSIX extension to C.
> I am using the C library coming with GNU linux distribution.
Compile and link with -pthreads and malloc() will be thread-safe, on x86
and AMD64.
So long,
Thomas
--
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
-- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.


|