Make the environment apply/unapply thread safe (i.e. there can be only one thread that constructs an EnvSetter object at a time)