note
tye
<p>
For each system, create a subdirectory for use just by that system. When a thread picks up a filename, use [doc://rename] to perform an atomic move of that file into the subdirectory for the system that the thread is hosted on. If the rename fails, then just skip that filename as the other system beat you to it.
</p><p>
Even better, when rename() fails, compare $! against ENOENT() from [mod://Errno]. If you are on a Unix system, than you can check "man 2 rename" on your particular system to verify that ENOENT is the appropriate choice (but if you are on a Unix system, then I'm pretty sure it will be).
</p><p>
In the unlikely event that you are not on a Unix system and are not using MS Windows, then Perl's [doc://rename] might not be atomic.
</p>
<div class="pmsig"><div class="pmsig-22609"><p align="right">
- [tye]<tt> </tt>
</p></div></div>
1175852
1175852