pthread_equal函数用法详解
pthread_equal函数简介
- 头文件包含
#include <pthread.h>
- 函数定义
int pthread_equal(pthread_t t1 , pthread_t t2 );
- 编译链接选项
-pthread
pthread_equal函数常见使用错误
- 链接错误
undefined reference to `pthread_equal'
解决办法:添加链接选项
-pthread
- 编译错误
warning: implicit declaration of function ‘pthread_equal’ [-Wimplicit-function-declaration]
解决办法:包含头文件
#include <pthread.h>
pthread_equal函数详细描述
pthread_equal ()函数比较两个线程标识符。
pthread_equal函数返回值
如果两个线程ID相等,pthread_equal ()返回一个非零值;否则,返回0。
pthread_equal函数错误码
这个函数总是成功的。
pthread_equal函数其他说明
pthread_equal ()函数是必要的,因为线程ID应该被认为是不透明的:应用程序没有可移植的方法来直接比较两个pthread_t值。
评论区