当需要获取线程号时,通过系统接口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