views:

273

answers:

1

I was just wandering if stdio::rename() function call is fully synchronous. So is the file immediately after return from the function call available under new name or it might take some time (some miliseconds) until this happens? I am investigating an irritating timing bug and suspect that the latter case happens.

My software runs on Win2k3 server machine.

+3  A: 

The MSVC runtime simply calls the MoveFile() API, which is synchronous.

If you're trying to create a new file with the old name (ie., how some editors save a file by renaming the original to `filename.bak' then saving the new file using the original filename) and you're being surprised that the new file has a creation date (and other metadata) that matches the original file's, then you might be getting bitten by 'Filesystem Tunneling':

Michael Burr