Multithreaded Programming Guide

Comparing Thread IDs

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

pthread_equal Syntax

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

pthread_t tid1, tid2;
int ret;

ret = pthread_equal(tid1, tid2);

pthread_equal Return Values

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