/* Event queues. Copyright 2002 Johan Rydberg, jrydberg@rtmk.org. This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _EVQ_H #define _EVQ_H 1 #include #define MAX_EVENTS 32 /* An queue is simply a mutex, a condition variable and an array of integers. The structure is protected by the mutex. */ struct evq { pthread_mutex_t mutex; pthread_cond_t cond; unsigned int eventq [MAX_EVENTS]; unsigned int *evqh; unsigned int *evqt; }; /* Initialize event queue EVQ. */ extern void evq_init (struct evq *evq); /* Wait for an event to be put on EVQ. We return the event. */ extern unsigned int evq_wait (struct evq *evq); /* Put EVENT on EVQ. */ extern void evq_signal (struct evq *evq, unsigned int event); #endif /* evq.h */