linux C 多线程/线程池编程 同步实例
摘要:
在多线程、线程池编程中经常会遇到同步的问题。1.创建线程 函数原型:int pthread_create(pthread_t *thread, const pthread_attr_t *attr,void*(*start_routine) (void *), void *arg); 参数:thread指向线程id的指针;attr指向线程属性的指针;第三个为执行的方法的函数指针;arg指向给方法传递的参数的指针。2.互斥变量 (1)互斥变量 pthread_mutex_t (2)互斥变量锁定 int pthread_mutex_lock(pthread_mutex_t *mutex... 阅读全文
posted @ 2013-12-18 19:22 旭东的博客 阅读(2686) 评论(0) 推荐(1) 编辑