关于iOS上的线程(一)

1. Certainly in Cocoa it is not safe to make any AppKit calls from any thread other than the main thread.

2. NSTimer 定时器运行调度(schedule)它的线程里。虽然定时器不是一个线程但它提供了异步执行行为。

3. NSRunLoop

每个线程都有一个NSRunLoop对象,该对象被自动创建。

NSRunloop对象是非线程安全的。

待续:

GCD

比线程更简单,比线程化的代码效率更高;

不用再关心线程的创建和管理,由系统来管理线程,系统可以根据负载情况动态的创建线程;

系统比你(程序员)更快的创建线程。(??? 直接创建内核线程 ???)

原文地址:https://www.cnblogs.com/cwgk/p/2153666.html