Where did you find (so quickly) that MoveFileEx is not atomic on Windows?On the page where you gave me the link. To be more precises: I could not see that atomicity would be guaranteed. To quote the part of that page which I believe to be relevant:
So, the renaming is win32_rename is just forwarded to the rename() function, and I couldn't find anything which would guarantee us that this would be atomic.1499: /* CRT is buggy on sharenames, so make sure it really isn't. 3259:win32_rename(const char *oname, const char *newname) 3314: /* if newname exists, rename it to a temporary name so that we 3348: retval = rename(szNewName, szTmpName); 3355: /* rename oname to newname */ 3356: retval = rename(szOldName, szNewName); 3360: /* ...and rename succeeded, delete temporary file/director +y */ 3365: (void)rename(szTmpName, szNewName);
I am willing to believe that this 'rename' will work atomically, if experienced Windows developer tell me so. It's just that I couldn't see this from the documentation.
In reply to Re^10: locking over the network (rename)
by rovf
in thread locking over the network
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |