Background: I am currently refactoring the Orbiter core build process, mainly for a clean separation of source, build and deployment directories. Currently it's a bit of a muddle, requiring lots of SVN ignore directives and manual copying.
As part of the changed build system, I now have a number of custom build steps that copy files (data files, scenarios, etc.) from the source to the deployment tree, in the form
if not exist $(TargetDir) mkdir $(TargetDir)
xcopy /d /y $(SourceDir)\$(File) $(TargetDir)\$(File)
This seems to work fine *until* I enable multiple build threads in Visual Studio. Then the build regularly fails with access violations.
So here is my question: Are the above commands threadsafe? If two threads try to create the same directory simultaneously, is this handled gracefully? Does Windows make a difference between read and write access to a file, and are two threads allowed to simultaneously get read access to the same file?
Is there another way to perform this operation in a threadsafe manner?
As part of the changed build system, I now have a number of custom build steps that copy files (data files, scenarios, etc.) from the source to the deployment tree, in the form
if not exist $(TargetDir) mkdir $(TargetDir)
xcopy /d /y $(SourceDir)\$(File) $(TargetDir)\$(File)
This seems to work fine *until* I enable multiple build threads in Visual Studio. Then the build regularly fails with access violations.
So here is my question: Are the above commands threadsafe? If two threads try to create the same directory simultaneously, is this handled gracefully? Does Windows make a difference between read and write access to a file, and are two threads allowed to simultaneously get read access to the same file?
Is there another way to perform this operation in a threadsafe manner?