Thread safety is not the issue. The issue is that multiple threads may want multiple different working directories simultaneously, for different work items. But there is one working directory for the process. This problem is partly alleviated by the ...at() family of system calls, of course.