Are boolean reads and writes guaranteed atomic in swift?

帅比萌擦擦* 提交于 2019-12-10 22:25:48

问题


Lets say I have an application that is writing to a boolean from one thread and reading from the same boolean from another thread.

I don't care if my reading thread reads a stale value. Is this safe on all ARM cores and x86? I don't want to run into an issue were a partially written value is read by my reading thread.

Follow up question: Which swift types have guaranteed atomic reads and writes on x86 and ARM?

来源:https://stackoverflow.com/questions/37932737/are-boolean-reads-and-writes-guaranteed-atomic-in-swift

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