make creation of tempdir thread-safe
update_3