From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-03-05 09:40:51
I have an application which sometimes fails saying that it can't create a
directory, because it already exists. The directory is created by
and the application is multi-threaded. It seems there's a race condition:
if (ph.empty() || exists(ph)) return;
// First create branch, by calling ourself recursively
// Now that parent's path exists, create the directory
After one thread checks that 'ph' does not exist, another one creates the same
directory, so call to 'create_directory' fails.
What can be done? Basically, adding a mutex for MT build and adding a warning
to docs are the variants. Opinions?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk