摘要: 转载~ (4条消息) 条件变量、pthread_cond_init_ 奋起的blog-CSDN博客_pthread_cond_init 阅读全文
posted @ 2021-10-07 20:46 Toretto瑞 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 创建一个线程默认的状态是joinable, 如果一个线程结束运行但没有被join,则它还有一部分资源没有被回收,所以创建线程者应该调用pthread_join来等待线程运行结束,并可得到线程的退出代码,回收其资源 ;但是调用pthread_join(pthread_id)后,如果该线程没有运行结束, 阅读全文
posted @ 2021-10-07 17:15 Toretto瑞 阅读(46) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <time.h> #include <pthread.h> #include <unistd.h> pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; void* doit(void* arg) 阅读全文
posted @ 2021-10-07 16:25 Toretto瑞 阅读(63) 评论(0) 推荐(0) 编辑