#include "stdio.h"
#include <thread>
//对元素的一些定义
typedef int item;
typedef int semaphore;
#define n 4//别打分号
int in = 0, out = 0;
item buffer[n];
semaphore mutex = 1, empty = n, full = 0;//标志定义
void producer() {
item nextp =
【操作系统】记录型信号量解决生产者消费者问题的简单尝试,C++并发
最新推荐文章于 2024-05-12 21:15:28 发布