PTHREAD_THREADID_NP(3) Library Functions Manual PTHREAD_THREADID_NP(3)

pthread_threadid_npget the calling thread's unique ID

#include <pthread.h>

int
pthread_threadid_np(pthread_t thread, uint64_t *thread_id);

The () function stores the system-wide unique integral ID of thread in the location spedified by thread_id. If thread is NULL, the ID of the current thread is provided.

If successful, the pthread_threadid_np() function will return zero. Otherwise an error number will be returned to indicate the error.

The pthread_threadid_np() function will fail if:

[]
NULL value for thread_id.
[]
Non-existent thread thread.

pthread_self(3)

April 12, 2016 Mac OS X 12