at least the implementations of mkpath/createDirectory on Unix and Windows first
1) check if the directory already exists, and then if it doesn't
2) create it
Step 2 can fail if another program created the directory between 1 & 2, letting the whole mkpath call fail (and preventing it from creating all the directories).
It should be possible to check if the mkdir or corresponding call failed because the directory already exists and continue nicely in that case.
(prominent example where this failed was running qdoc on multiple configurations with output directories having the same, not-yet existing parent directory, in parallel)