摘要: 条件变量实现:记一次由虚假唤醒产生的bug 信号量实现: #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h 阅读全文
posted @ 2022-01-21 17:25 hellozhangjz 阅读(113) 评论(0) 推荐(0)
摘要: 记一次由虚假唤醒产生的bug 用int a代表产品数量最少0最多10,有两个生产者,三个消费者,用多线程和条件变量模拟生产消费过程: #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdlib.h 阅读全文
posted @ 2022-01-21 16:47 hellozhangjz 阅读(70) 评论(0) 推荐(0)