5

Could anyone please explain the meaning of the returned value of [NSThread currentThread]?

NSLog

NSLog(@"%@", [NSThread currentThread]);

Result

<NSThread: 0x1e04ed60>{name = (null), num = 5}

What are the following?

  1. "NSThread: 0x1e04ed60"
  2. name = (null)
  3. num = 5

num = 5 doesn't have anything to do with the Thread number listed in the Xcode (which it shows Thread 9 for this instance, since I'm running multiple threads with NSOperationQueue)

the explanation from apple doc is pretty useless, Return Value A thread object representing the current thread of execution. https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSThread_Class/Reference/Reference.html

Thank you!

Jerry
  • 1,018
  • 4
  • 13
  • 22

1 Answers1

4

The first is the memory address. The second is the thread name. You can set the name of a thread. The third number can be explained in these posts:

See:

po [NSThread currentThread]

and

NSThread number on iOS?

Community
  • 1
  • 1
bandejapaisa
  • 26,576
  • 13
  • 94
  • 112