linux应用开发-线程

时间:2015-05-19 13:08:32   收藏:0   阅读:190
linux应用开发-线程

一 线程操作函数

注意事项:
头文件:#include <pthread.h>
编译注意: 链接库 -lpthread

1 创建线程

int pthread_create(pthread_t *thread, const pthread_attr, void *(*start_routine)(void *0, void *arg))


2 退出线程

void pthread_exit(void *retval)


3 子线程退出

void pthread_join(pthread_t thread, void **retval)


4 取消线程
int pthread_cancel(pthread_t thread);

二 线程通信
技术分享

三 线程同步

技术分享

1 互斥
2 信号量

3 条件变量

技术分享

技术分享

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!