The described problem (thread safety) for a global configuration seems mostly a misunderstanding by the author.
The usual case for modifying a global state is: modify once, then proceed (e.g. start new threads). Even if all the calls become thread safe, the behavior would be inconsistent, still.
It is perfectly reasonable and consistent for one thread to set an environment variable while other threads are reading different environment variables.
The usual case for modifying a global state is: modify once, then proceed (e.g. start new threads). Even if all the calls become thread safe, the behavior would be inconsistent, still.