pthread_equal 子例程
用途
比较两个线程标识。
库
线程库 (libpthreads.a)
语法
#include <pthread.h>
int pthread_equal (thread1, thread2)
pthread_t thread1;
pthread_t thread2;描述
pthread_equal 子例程比较线程标识 thread1 和 thread2。 由于线程标识是不透明对象,因此不应假定它们可以使用等号运算符 (==) 进行比较。
注: pthread.h 头文件必须是使用线程库的每个源文件的第一个包含文件。 否则,应使用 -D_THREAD_SAFE 编译标志,或使用 cc_r 编译器。 在这种情况下,会自动设置标志。
参数
| 项 | 描述 |
|---|---|
| thread1 | 指定要比较的第一个标识。 |
| thread2 | 指定要比较的第二个标识。 |
返回值
如果 thread1 和 thread2 相等,那么 pthread_equal 函数返回非零值; 否则,返回零。
如果 thread1 或 thread2 不是有效的线程标识,那么行为是未定义的。