ios: NSConditionLock
锁的相关介绍可以参照:http://blog.csdn.net/lifengzhong/article/details/7487505 看NSConditionLock类的属性方法: lock,unlock:加锁和解锁,是required method。 - (id)initWithCondition:(NSInteger)condition :初始化对象。有一个整形的conditon参数,表示条件。 - (void)lockWhenCondition:(NSInteger)condition :“The receiver’s condition must be equal to condition before the locking operation will succeed. This method blocks the thread’s execution until the lock can be acquired.” 进程会一直阻塞,一直到满足conditon并完成加锁。 - (void)unlockWithCondition:(NSInteger)condition ...
