Getting thread id of current method call
NSLog(@"%@", [NSThread currentThread]);
In Swift 5
print("Current thread \(Thread.current)")
#include <pthread.h>
...
mach_port_t machTID = pthread_mach_thread_np(pthread_self());
NSLog(@"current thread: %x", machTID);