开发者

NSLocks in Objective C

开发者 https://www.devze.com 2023-03-07 22:25 出处:网络
We use NSLock fo开发者_高级运维r locking in Objective C. I am porting a c plus plus code. There they have used locks for critical section and mutex locks.

We use NSLock fo开发者_高级运维r locking in Objective C. I am porting a c plus plus code. There they have used locks for critical section and mutex locks. Is NSLock sufficient to lock critical section as well as mutex.


I'd say that NSLock is sufficient, but if you think that you might have to lock while the lock is already locked (thereby causing a deadlock), you may want to look at NSRecursiveLock.

0

精彩评论

暂无评论...
验证码 换一张
取 消