You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
480 B
25 lines
480 B
#ifndef queue_H
|
|
#define queue_H
|
|
|
|
#include "sockaddr.h"
|
|
#include <semaphore.h>
|
|
#include <pthread.h>
|
|
|
|
typedef struct _QueueItem {
|
|
struct _QueueItem *next;
|
|
char data[];
|
|
} QueueItem;
|
|
|
|
typedef struct _Queue {
|
|
QueueItem *head;
|
|
QueueItem *last;
|
|
sem_t count;
|
|
pthread_mutex_t mutex;
|
|
} Queue;
|
|
|
|
extern void Queue_addItem(Queue *list,QueueItem *item);
|
|
extern QueueItem *Queue_getItem(Queue *list);
|
|
extern void Queue_initialize(Queue *list,int n,size_t size);
|
|
|
|
#endif
|
|
|
|
|