in reply to Re^9: locking over the network (rename)
in thread locking over the network
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: locking over the network (rename)
by Corion (Patriarch) on Feb 02, 2011 at 11:23 UTC | |
by rovf (Priest) on Feb 02, 2011 at 11:49 UTC | |
by Corion (Patriarch) on Feb 02, 2011 at 11:58 UTC |