On 9/12/2011 2:38 AM, Ignaz Birnstingl wrote: > I guess the patch didn't make it to trunk so I'll restate why I think > this should make it to future versions of APR: > -) The documentation says about argument pool: "where to allocate > value and any temporary storage from". If *value is not allocated from > pool then manipulating the data pointed to it can have any kinds of > side-effects. > -) The single UNIX specification states that getenv() "need not be > reentrant" and in fact it is not on some platforms, like the z/OS USS. > Thus apr_env_get is not reentrant on some platforms. Even with my > patch the documentation should probably state that the function is not > thread-safe and requires external serialization.
[un]setenv/putenv are never thread safe. You are confusing the issues, if the environment is volatile after threads are created the code is broken. Your 'fix' has a race condition and is therefore not the solution.
