linux 线程创建和结束
2016-07-07 17:50
555 查看
1.创建线程
int pthread_create(pthread_t *tidp, const pthread_attr_t *attr, (void*) (*start_rtn)(void*), void *arg);
tidp:线程标识符指针
attr:线程属性
start_rtn:运行函数的起始指针
arg:传递给运行行数的参数
2:阻塞等待线程结束
int pthread_join(pthread_t thread, void **retval);
thread:线程标识符
retval:存储被等待线程的返回值
3:非阻塞,线程正常结束退出。
pthread_detach(thread_id);
int pthread_create(pthread_t *tidp, const pthread_attr_t *attr, (void*) (*start_rtn)(void*), void *arg);
tidp:线程标识符指针
attr:线程属性
start_rtn:运行函数的起始指针
arg:传递给运行行数的参数
2:阻塞等待线程结束
int pthread_join(pthread_t thread, void **retval);
thread:线程标识符
retval:存储被等待线程的返回值
3:非阻塞,线程正常结束退出。
pthread_detach(thread_id);
相关文章推荐
- linux下操作mysql
- Linux 2.6.0 中select()的主要代码片断——The C10M Problem
- centos7.2安装cobbler 并安装系统
- Linux 2.4.0 中select()的主要代码片断——The C10M Problem
- Linux安装MySQL的两种方法
- Linux的fasync驱动异步通知详解
- Linux 2.2.0 中select()的主要代码片断——The C10M Problem
- Linux常用命令
- linux添加路由
- CentOS 7 上部署Mono 4 和Jexus 5.6
- Linux下I2C设备驱动开发和实现
- linux 内核库函数 【转】
- Linux下使用I2C总线读写 EEPROM(读写i2c从设备通用程序)
- 基本进程调度算法总结
- linux驱动--设备节点生成
- pread与pwrite
- BAT 脚本------读取ssn再写回
- Linux下5种动态库运行时搜索路径的方法
- 解析Linux内核的基本的模块管理与时间管理操作---超时处理【转】
- yum 升级centos6.5内核