How does one programmatically determine if “write” system call is atomic on a particular file?

徘徊边缘 提交于 2019-12-01 19:38:16

The write call as defined in POSIX has no atomicity guarantee at all. So you don't need to confirm anything, it's not atomic.

It doesn't even guarantee that the data will have reached the hard drive (if there is a drive at all) if it completes successfully. Successfully reading back the data doesn't give you any guarantees either.

You'll need to use the sync family of functions to get some durability guarantees.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!