gettid()获取线程ID测试程序
来源:互联网 发布:程序员培训班兄弟 编辑:程序博客网 时间:2024/05/29 09:52
1、第一种方法
[root@zhuliting ft]# g++ hello.c -o hello -lpthread
[root@zhuliting ft]# ./hello
Hello! 0
Thread id:17783
Hello! 1
Thread id:17784
Hello! 2
Thread id:17785
注意:
1、第5、6行不能少,否则会出现错误:error: ‘gettid’ was not declared in this scope
2、#include <sys/types.h>代替第5、6行
http://www.kernel.org/doc/man-pages/online/pages/man2/gettid.2.html
3、编译加上-lpthread选项,不然会出现“undefined reference to `pthread_create'”错误
- gettid()获取线程ID测试程序
- 获取当前线程的id号 gettid()
- Linux下获取线程TID的方法——gettid()
- Linux下获取线程TID的方法——gettid()
- Linux下获取线程TID的方法——gettid()
- Linux下获取线程TID的方法——gettid()
- Linux下获取线程TID的方法——gettid()
- Linux下获取线程TID的方法——gettid()
- 获取线程标识函数gettid和pthread_self的区别
- Linux下获取线程TID的方法——gettid() 获取进程 getpid()
- 线程性能测试 top 错误:‘gettid’ 在此作用域中尚未声明
- Linux获取线程ID
- 获取线程ID
- 获取线程ID
- 获取线程ID
- Liunx获取线程Id
- 3.4 线程id获取
- linux获取线程ID
- 用Instant Client,不安装oracle客户端使用sqlplus连接远程数据库
- STL简介
- 像设计师一样思考:设计师的11个小贴士
- Java、Extjs构建CRM客户管理系统(送源码)
- MYSQL中限制资源的使用
- gettid()获取线程ID测试程序
- 对于iis权限的问题
- eclipse中refresh的作用?
- delphi 實現通過ip地址獲取mac地址
- MySQL的DATETIME, TIMESTAMP类型列的默认值
- CuteEditor6.0 使用详解
- c语言拾遗4
- 20个免费的JavaScript图表、flash图表生成代码集锦
- 学习设置Jtable