在单个线程中使用NSNotifications时是否存在竞态条件问题?下面是一个示例方法:NSNotification竞争条件
- (void) playerToggled: (NSNotification *) notification {
if (timerPane.playing && ! timerPane.paused) {
[playerPane toggleCurrentPlayer];
[timerPane toggleTimer];
[mainPane playerToggled];
}
}
的条件后的前两个电话将触发将由mainPane接收NSNotifications。 mainPane是否保证在收到通知后收到playerToggled消息?我应该说这个代码似乎按照需要工作(playerToggled总是最后执行)。但我不确定在通知周围存在什么时间问题,我找不到具体的答案。
顺便说一句,你应该真的接受你到目前为止询问的10个问题的一些答案。 –