> [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. You are right, they are never thread-safe. However if apr_env_get would pstrdup the returned value that would at least make it reentrant.
> Your 'fix' has a race condition and is therefore not the solution. That's what I meant with "the documentation should probably state that the function is not thread-safe and requires external serialization." But at second thought thread-safety is documented nowhere for APR so this can be omitted.
