【Linux】undefined reference to `gettid
时间:2023-12-12 23:37:02
通过系统接口获取线程号gettid,如题会出现编译错误。
看一下gettid界面说明:
意思是:系统不提供gettid接口的调用需要通多syscall获取线程的方法ID。
方式:syscall(SYS_gettid)
对于线程ID有两个概念需要区分:
1.一是创建线程时返回pthread_t
2.这样得到的线程ID
详情请参考:
【Linux】获取线程ID方法_sidemap的博客-CSDN博客threadhttps://blog.csdn.net/sidemap/article/details/125151548?spm=1001.2014.3001.5501