This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getenv not thread safe


Ulrich Drepper wrote:
> 
> Michael Eager wrote:
> > On an SMP system, it's possible that getenv may be walking the
> > environment while setenv is reallocating it.
> 
> Then don't do this.  POSIX explicitly says the *env functions are not
> thread safe.

Then perhaps the glibc documentation should not claim to be thread safe:

   Environment Access

   The value of an environment variable can be accessed with the getenv 
   function. This is declared in the header file stdlib.h. All of the 
   following functions can be safely used in multi-threaded programs. 
   It is made sure that concurrent modifications to the environment do 
   not lead to errors. 

http://www.gnu.org/software/libc/manual/html_node/Environment-Access.html#Environment%20Access


--
Michael Eager     eager@mvista.com	408-328-8426	
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA  94085


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]