简体   繁体   中英

Is os.replace() atomic on Windows?

In the docs it says that replacing files are guaranteed to be atomic on POSIX systems. Does this mean that it's not atomic on Windows?

As visible in this thread the atomic replace functionality for windows has been added for version 3.3.

The patch is visible here .

In the background MoveFileEx with when nessesary the MOVEFILE_REPLACE_EXISTING flag added is called.

MoveFileEx is the same method as the openjdk calls . I can't find any documentation stating it is atomic, but the community seems to rely on it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM