1
/*
2
 * Copyright (C) 2008-2010 Nokia Corporation
3
 *
4
 * Author: Felipe Contreras <felipe.contreras@nokia.com>
5
 *
6
 * This file may be used under the terms of the GNU Lesser General Public
7
 * License version 2.1, a copy of which is found in LICENSE included in the
8
 * packaging of this file.
9
 */
10
11
#ifndef ASYNC_QUEUE_H
12
#define ASYNC_QUEUE_H
13
14
#include <glib.h>
15
16
typedef struct AsyncQueue AsyncQueue;
17
18
struct AsyncQueue {
19
	GMutex *mutex;
20
	GCond *condition;
21
	GList *head;
22
	GList *tail;
23
	guint length;
24
	gboolean enabled;
25
};
26
27
AsyncQueue *async_queue_new(void);
28
void async_queue_free(AsyncQueue *queue);
29
void async_queue_push(AsyncQueue *queue, gpointer data);
30
gpointer async_queue_pop(AsyncQueue *queue);
31
gpointer async_queue_pop_forced(AsyncQueue *queue);
32
void async_queue_disable(AsyncQueue *queue);
33
void async_queue_enable(AsyncQueue *queue);
34
void async_queue_flush(AsyncQueue *queue);
35
36
#endif /* ASYNC_QUEUE_H */