Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

meaning of the returned value of [NSThread currentThread]

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!

like image 265
Jerry Avatar asked Oct 03 '22 15:10

Jerry


1 Answers

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?

like image 151
bandejapaisa Avatar answered Oct 12 '22 10:10

bandejapaisa