rdicosmo / parmap

Parmap is a minimalistic library allowing to exploit multicore architecture for OCaml programs with minimal modifications.
http://rdicosmo.github.io/parmap/
Other
94 stars 20 forks source link

can_redirect: don't treat mkdir returning EEXIST as an error #45

Closed jeffmahoney closed 8 years ago

jeffmahoney commented 8 years ago

can_redirect's test for existance of the path followed by the mkdir is inherently racy. It's trivially possible to encounter a situation where the test for existance fails in two processes and one of them succeeds in creating the directory. Since both processes are looking to create and use the directory for the same purpose, we don't need to treat EEXIST as an error.

rdicosmo commented 8 years ago

Thanks for noticing and fixing this!