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

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

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

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

相关文章:

  • 2021-10-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-12-05
  • 2021-12-03
猜你喜欢
  • 2021-07-20
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案