root/wiimote/queue.h @ d37162faf05813012a7b970af3a48f7b46e034c9

Revision d37162faf05813012a7b970af3a48f7b46e034c9, 1.5 KB (checked in by dsmith <dsmith@…>, 6 years ago)

Fixed per-file ChangeLog? date format pt 2

git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@68 918edb2d-ff29-0410-9de2-eb38e7f22bc7

  • Property mode set to 100644
Line 
1/* Copyright (C) 2007 L. Donnie Smith <cwiid@abstrakraft.org>
2 *
3 *  This program is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  This program is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with this program; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 *  ChangeLog:
18 *  2007-04-04 L. Donnie Smith >cwiid@abstrakraft.org>
19 *  * Added queue_flush prototype
20 *
21 *  2007-03-03 L. Donnie Smith <cwiid@abstrakraft.org>
22 *  * Initial ChangeLog
23 */
24
25#ifndef QUEUE_H
26#define QUEUE_H
27
28#include <pthread.h>
29
30typedef void free_func_t(void *);
31
32struct queue_node {
33        void *data;
34        struct queue_node *next;
35};
36
37struct queue {
38        pthread_mutex_t mutex;
39        pthread_cond_t cond;
40        pthread_mutex_t cond_mutex;
41        struct queue_node *head;
42        struct queue_node **p_tail;
43};
44
45struct queue *queue_new();
46int queue_flush(struct queue *queue, free_func_t free_func);
47int queue_free(struct queue *queue, free_func_t free_func);
48int queue_queue(struct queue *queue, void *data);
49int queue_dequeue(struct queue *queue, void **data);
50int queue_wait(struct queue *queue);
51
52#endif
Note: See TracBrowser for help on using the browser.