On 05/12/2014 11:23 AM, Eric Berge wrote: > My first question is whether the cmake code was expecting to > avoid this type of race by other means or it was just expecting > that the last one would succeed.
The goal is to write a file atomically because multiple processes might be trying to do so at once. We do not care which one wins. The standard approach in the POSIX world is to write to a temporary file name and then rename atomically once at the end. This seems virtually impossible to achieve on Windows. The code is here: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmSystemTools.cxx;hb=v3.0.0-rc4#l904 We already have a retry loop. I recently added an undocumented way to configure it: Windows: Make file delete/rename retry configurable http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b1f966a I cannot imagine every application that wants to create a file atomically on Windows has to go through this. Any idea how to do it better? Is inter-process synchronization (e.g. locking) really needed just to create a file reliably? -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
