Threads & Concurrency

同步-异步,
阻塞-非阻塞,thread的状态,等待还是不等待
并发-锁、死锁,同时发生



Threading Programming Guide

http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html#//apple_ref/doc/uid/10000057i-CH1-SW1

RunLoop号称是基础消息机制,看了下模型是个消息队列,用于同步消息。


NSRunLoop对象接口也比较少,理清下面几这个这就够了。
+ (NSRunLoop *)currentRunLoop;
+ (NSRunLoop *)mainRunLoop NS_AVAILABLE(10_5, 2_0);


- (void)addTimer:(NSTimer *)timer forMode:(NSString *)mode;
- (void)addPort:(NSPort *)aPort forMode:(NSString *)mode;
- (void)removePort:(NSPort *)aPort forMode:(NSString *)mode;


- (void)run; 
- (void)runUntilDate:(NSDate *)limitDate;
- (BOOL)runMode:(NSString *)mode beforeDate:(NSDate *)limitDate;

还有那坨performSelector


//run loop 是非阻塞的,其它是阻塞的,oh~
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]];
sleep(3);
[NSThread sleepUntilDate:[NSDate distantPast]];












http://www.cocoachina.com/bbs/simple/?t43852.html

一些相关类与概念
NSThread (基层)
NSOperation(对NSThread封装) 与 NSOperationQueue
NSTimer
NSRunloop
CADisplayLink
主线程 performSelectorOnMainThread

NSOperation:http://bj007.blog.51cto.com/1701577/411181
NSTimer:http://mobile.51cto.com/iphone-282221.htm
Run Loop:http://blog.csdn.net/nerohoop/article/details/7214662
CADisplayLink:http://blog.sina.com.cn/s/blog_68237cd10100yptj.html




NSInvocation
NSInvocationOperation
NSBlockOperation

http://www.dev3g.com/?p=36
http://blog.csdn.net/freshforiphone/article/details/7381329

http://hi.baidu.com/zhulin014/blog/item/a9ec6d1288041638dd5401ae.html


//	NSLock          : NSObject <NSLocking>
//	NSCondition     : NSObject <NSLocking>对象锁
//	NSConditionLock : NSObject <NSLocking>条件锁NSConditionLock,
//	NSRecursiveLock : NSObject <NSLocking>循环锁NSRecursiveLock,



http://blog.csdn.net/favormm/archive/2010/01/27/5262708.aspx

Sending Messages

– performSelector:withObject:afterDelay:
– performSelector:withObject:afterDelay:inModes:
– performSelectorOnMainThread:withObject:waitUntilDone:
– performSelectorOnMainThread:withObject:waitUntilDone:modes:
– performSelector:onThread:withObject:waitUntilDone:
– performSelector:onThread:withObject:waitUntilDone:modes:
– performSelectorInBackground:withObject:
+ cancelPreviousPerformRequestsWithTarget:
+ cancelPreviousPerformRequestsWithTarget:selector:object:

@end

你可能感兴趣的:(thread,Blog,ITeye)