摘要: 主线程产生两个子线程,交替打印出各自的线程ID: 1 #include <stdio.h> 2 #include <pthread.h> 3 #include <stdlib.h> 4 5 static int flag=0;/*0-print thread 1, 1-print thread 2*/ 6 static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; 7 static pthread_mutex_t mutx = PTHREAD_MUTEX_INITIALIZER; 8 9 static voi 阅读全文
posted @ 2012-06-27 00:14 衡宇 阅读(709) 评论(0) 推荐(0) 编辑