In linux c program, how to print thread id of a thread created by pthread library? for ex: we can get pid of a process by getpid()
getpid()
pid_t tid = syscall(SYS_gettid);
Linux provides such system call to allow you get id of a thread.