Multithreaded Programming Guide

Compare Thread IDs

pthread_equal(3THR)

Use pthread_equal(3THR) to compare the thread identification numbers of two threads.

Prototype:
int	 pthread_equal(pthread_t tid1, pthread_t tid2);
#include <pthread.h>

pthread_t tid1, tid2;
int ret;

ret = pthread_equal(tid1, tid2);

Return Values

pthread_equal() returns a nonzero value when tid1 and tid2 are equal; otherwise, zero is returned. When either tid1 or tid2 is an invalid thread identification number, the result is unpredictable.