On 17 March 2003, Graham Fawcett said:
> How about letting the OS do the collision detection -- skip the "if
> doesn't exist, then create it" idiom, just try to create it and let the
> OS pick the winner? That removes the thread safety issue, I think, since
> we're leaving the locking to the OS.
But open() doesn't work that way. open(filename, "wb") unconditionally
clobbers filename. That's one way to resolve the race condition, I
suppose, but not really satisfactory.
I'll take Dave's suggestion and see how tempfile does it and maybe even
use that module instead of reinventing the wheel.
Greg
--
Greg Ward - software developer gward@mems-exchange.org
MEMS Exchange http://www.mems-exchange.org