Only overwrite tmp files if not a worker thread
Only overwrite tmp files if not a worker thread

This is the simplest, most transparent, workaround I could think of for the issue of worker threads stomping on each other when writing tmp files.

The solution is pretty straight forward:

* If the current process is not a worker thread (meaning there are no other threads/processes taht could overwrite the tmp file beign worked on) naively write the file
* If the current process _is_ a worker thread, there are other threads/processes that might be trying to write the same tmp file, so only attempt a write if the file does not exist

This doesn't completly eliminate the possibility of a race condition or processes/threads stomping on each other, but it's the best I can do.

bsgbryan/madul