iOS中的互锁操作? [英] Interlocked operations in iOS?

查看:173
本文介绍了iOS中的互锁操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS SDK中是否有互锁(原子)操作?

Are there interlocked(atomic) operations in iOS SDK?

我需要互锁的increment \decrement和互锁的比较。

I need interlocked increment\decrement and interlocked comparsion.

* 更新:* 我的主要问题是等待几个由主线程创建的NSThreads(主线程不能工作, 。

*UPDATE: * My main problem is waiting for few NSThreads created by main thread(main thread mustn't work while other threads work).

我不知道该怎么做。

推荐答案

您可以使用 OSAtomicIncrement * / OSAtomicDecrement * .com / library / ios / DOCUMENTATION / Cocoa / Conceptual / Multithreading / ThreadSafety / ThreadSafety.html#// apple_ref / doc / uid / 10000057i-CH8-SW14>使用原子操作

You can use the OSAtomicIncrement*/OSAtomicDecrement* operations described in Using Atomic Operations.

这篇关于iOS中的互锁操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆