summaryrefslogblamecommitdiff
path: root/queue.h
blob: 4ca9b4aa1968bd45405b8aec5d6d8f7285f4f6b2 (plain) (tree)
























                                
/*
 * vim: ft=c
 */

#ifndef QUEUE_H
#define QUEUE_H

#include <semaphore.h>
#include <pthread.h>

typedef struct {
    pthread_mutex_t mtx;
    sem_t size;
    void *elements[100];
    int front;
    int back;
} queue;

int init_queue(queue *q);

int enqueue(queue *q, void  *v);
int dequeue(queue *q, void **v);
int pq_close(queue *q);

#endif /* QUEUE_H */