It is unsafe to modify or add environment variables in a threaded application on Linux systems. This is due to limitations of the underlying system libraries. It is however safe to read values from environment variables.