On Mon, Jan 4, 2016 at 10:51 AM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:

> > getenv should be threadsafe according to:
> >
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01
>
>
>
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/getenv.html
>
> seems to claim otherwise?
>
> "The getenv() function is inherently not thread-safe because it returns a
> value pointing to static data.”
>
>
>From the first link claiming that getenv() is thread safe... how are you
reading that? I see:

    "the following functions need not be thread-safe: (...) getenv()"

Also note below the function list:

    Since multi-threaded applications are not allowed to use the
*environ* variable
to access or modify any environment variable while any other thread is
concurrently modifying any environment variable, any function dependent on
any environment variable is not thread-safe if another thread is modifying
the environment

(plus a link to the environment variables documentation which explicitly
relates getenv() to `environ`)

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to