Linux老版本下gettid的not declared问题

Linux对线程的支持有点土啊,今天在一台Turbo Linux 13的机器上,使用gettid死活提示:
gettid was not declared in this scope....

网上参考了这篇文章

对于比较老的版本,需要借助系统调用才能完成获取线程ID……

#include <sys/syscall.h>
#define gettid() syscall(__NR_gettid)

Leave a Reply

Your email address will not be published. Required fields are marked *