-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
34 lines (27 loc) · 688 Bytes
/
queue.h
File metadata and controls
34 lines (27 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef QUEUE_H
#define QUEUE_H
#include <pthread.h>
typedef struct Queue {
int enqueueCount;
int dequeueCount;
int enqueueBlockCount;
int dequeueBlockCount;
int front;
int back;
int curAmount;
int capacity;
char** strings;
pthread_mutex_t lock;
pthread_cond_t empty;
pthread_cond_t full;
}Queue;
typedef struct QueuePointer {
Queue* q1;
Queue* q2;
}QueuePointer;
QueuePointer *CreateStringQueuePointer(Queue* q1, Queue* q2);
Queue* CreateStringQueue(int size);
void EnqueueString(Queue *q, char* string);
char* DequeueString(Queue *q);
void PrintQueueStats(Queue *q);
#endif /* QUEUE_H */