My basic problem is that I'm having a hard time implementing a Pthread that consists of a round robin dequeuing 4 arrays consisting of ints. Followed by a Pthread that creates random numbers with which to enqueue them with. I've written most of the code for the queue itself and I've read up a lot on Pthreads, but I haven't found anything that explains it clearly. Here is my code for reference.


define MaxQueueSize 10
define FALSE 0
define TRUE 1

typedef struct {

int content[MaxQueueSize];
int head;
int tail;
int count;
int dropped;


void initializeQ(queue content);
void enqueue(queue
qPtr,int i);
int dequeue(queue qPtr);
int randomLimit(int low, int high);
int randomLimit(int low, int high);
int isEmpty(queue
int isFull(queue *qPtr);

void initializeQ(queue *content){

content->head = 0;
content->tail = MaxQueueSize - 1;
content->count = 0;
content->dropped = 0;


void enqueue(queue *qPtr,int i){

//has a 50 percent chance of dropping i instead of queuing it
if(qPtr->count > (MaxQueueSize*.9)){
qPtr->tail = (qPtr->tail + 1) % MaxQueueSize;
qPtr->content[qPtr->tail] = i;
qPtr->count = qPtr->count++;

int dequeue(queue *qPtr){

int n = qPtr->content[qPtr->head];
qPtr->head = (qPtr->head + 1) % MaxQueueSize;
qPtr->count = qPtr->count - 1;

return n;


int isEmpty(queue *qPtr){

if(qPtr->count == 0)
return TRUE;

return FALSE;


int isFull(queue *qPtr){

if(qPtr->count == MaxQueueSize)
return TRUE;

return FALSE;

int randomLimit(int low, int high){

int k;
double d;

d = (double) rand() / ((double) ...