介绍忙等待,互斥量,信号量,条件变量:以估计π为例(并行计算,用Pthread库)
首先是一个hellowerld程序,创建多个线程并打印语句,主要是想说明这三个函数:
int pthread_create(pthread_t* thread,const pthread_attr_t* attr,void* fuc,void* arg);//创建线程并关联运行函数
int pthread_join(pthread_t* thread, void **retval);//等待其...
原创
2019-04-14 17:31:46 ·
3448 阅读 ·
0 评论