Getting thread id of current method call

Viewed 63518

Is there a way to print out the current thread id on which the current method is executing on?

(objective-c please)

8 Answers

In Swift4

print("\(Thread.current)")

NSLog prints to the console a number (in square brackets after the colon) identifying the thread on which it was called.

NSLog output

uint64_t tid; pthread_threadid_np(NULL, &tid);

Related