Java生产者 - 消费者程序使用线程&同步队列,程序被分成3个类但它不能运行。 Queue.java: public class Queue {
static final int MAXQUEUE = 3;
int[] queue = new int[MAXQUEUE];
int front, rear;
public Queue(){ front = 0
我已经实施了一个解决方案,使用pthreads和信号量在C中的生产者/消费者问题。 我的主线程是生产者,我启动N个消费者线程。 我的代码是: typedef struct
{
int buf[BUFSIZE]; /* shared var */
int in; /* buf[in%BUFSIZE] is the first empty slot */
int