RE: Are g_try_malloc() and g_free() thread-safe?



I think this is what you had in mind:
find -name "*.h" -exec grep REENTRANT '{}';\ -print

Indeed, I found nothing.  What then would be the proper course of
action?  Certainly a function can be reentrant without accommodating
this macro, but how would I know which are and are not?

-----Original Message-----
From: Paul Davis [mailto:paul linuxaudiosystems com] 
Sent: Tuesday, February 08, 2005 10:38 AM
To: Christ, Bryan
Cc: Ben Johnson; gtk-list gnome org
Subject: Re: Are g_try_malloc() and g_free() thread-safe? 

>g_mem_set_vtable() doesn't really help (at least right now) because I 
>can't get any definitive information on whether malloc() and free() are

>thread-safe.  I am building with -D_REENTRANT so the thread-safe

can i make a suggestion to you. try running find(1) on all your header
files and feed the results through grep looking for REENTRANT.

on my system (fedora core 1), there are *zero* occurences of this.

AFAIK, the thread-safe versions of malloc/free are part of the pthreads
library that is linked to your code. the _REENTRANT macro is a stub
thing that lives on in case one day there does need to be something in
the header files, but actually does nothing on any
(most?) current linux systems.

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]