[NSThread currentThread] 返回值的含义

Jer*_*rry 5 debugging nsthread ios

谁能解释一下 [NSThread currentThread] 返回值的含义?

日志

NSLog(@"%@", [NSThread currentThread]);
Run Code Online (Sandbox Code Playgroud)

结果

<NSThread: 0x1e04ed60>{name = (null), num = 5}
Run Code Online (Sandbox Code Playgroud)

以下是什么?

  1. “NSThread:0x1e04ed60”
  2. 名称 = (空)
  3. 数量 = 5

num = 5 与 Xcode 中列出的线程编号没有任何关系(它在此实例中显示了线程 9,因为我正在使用 NSOperationQueue 运行多个线程)

苹果文档的解释非常无用,返回值代表当前执行线程的线程对象。 https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSThread_Class/Reference/Reference.html

谢谢!

ban*_*isa 4

第一个是内存地址。第二个是线程名称。您可以设置线程的名称。第三个数字可以在这些帖子中解释:

看:

po [NSThread 当前线程]

iOS 上的 NSThread 数量?