Interlocked operations in iOS?

前端 未结 4 748
感动是毒
感动是毒 2021-01-04 08:11

Are there interlocked(atomic) operations in iOS SDK?

I need interlocked increment\\decrement and interlocked comparsion.

*UPDATE: * My main proble

4条回答
  •  清歌不尽
    2021-01-04 08:41

    Update: Language level atomics under C11 and C++11 are now available.

    You can simply declare _Atomic(int) a;.

    A more detailed introduction.


    atomic operations and their documentation can be found in libkern/OSAtomic.h. an overview can be found under man atomic.

    as well, you will likely find C11 and C++11 language/library support very soon.

提交回复
热议问题