Files
smmapdfw/smmapdfw/libsmmapdfw/queue.h
2004-10-11 15:28:12 +00:00

52 lines
1.3 KiB
C

/*
Copyright (C) 2004, Wolfgang Hottgenroth
This file is part of smmapdfw.
smmapdfw is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
smmapdfw is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with smmapdfw. If not, write to the Free Software Foundation, 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _QUEUE_H_
#define _QUEUE_H_
#include <pthread.h>
struct queue_entry_s {
void *data;
struct queue_entry_s *next;
struct queue_entry_s *prev;
};
typedef struct queue_entry_s queue_entry_t;
struct queue_s {
queue_entry_t *tail;
queue_entry_t *head;
pthread_mutex_t mutex;
pthread_cond_t cond;
};
typedef struct queue_s ht_queue_t;
void queue_init(ht_queue_t *q);
void queue_destroy(ht_queue_t *q);
int queue_put(ht_queue_t *q, void *d);
void *queue_get_wait(ht_queue_t *q);
#endif /* _QUEUE_H_ */