線程間通信:在1個進程中,線程往往不是孤立存在的河劝,多個線程之間需要經(jīng)常進行通信
線程間通信的體現(xiàn)
1個線程傳遞數(shù)據(jù)給另1個線程
在1個線程中執(zhí)行完特定任務(wù)后,轉(zhuǎn)到另1個線程繼續(xù)執(zhí)行任務(wù)
線程間通信常用方法
- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait;
- (void)performSelector:(SEL)aSelector onThread:(NSThread *)thr withObject:(id)arg waitUntilDone:(BOOL)wait;