tizen beta release
[profile/ivi/gst-openmax0.10.git] / util / async_queue.h
1 /*
2  * Copyright (C) 2008-2009 Nokia Corporation.
3  *
4  * Author: Felipe Contreras <felipe.contreras@nokia.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation
9  * version 2.1 of the License.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifndef ASYNC_QUEUE_H
23 #define ASYNC_QUEUE_H
24
25 #include <glib.h>
26
27 typedef struct AsyncQueue AsyncQueue;
28
29 struct AsyncQueue
30 {
31   GMutex *mutex;
32   GCond *condition;
33   GList *head;
34   GList *tail;
35   guint length;
36   gboolean enabled;
37 };
38
39 AsyncQueue *async_queue_new (void);
40 void async_queue_free (AsyncQueue * queue);
41 void async_queue_push (AsyncQueue * queue, gpointer data);
42 gpointer async_queue_pop (AsyncQueue * queue);
43 gpointer async_queue_pop_forced (AsyncQueue * queue);
44 void async_queue_disable (AsyncQueue * queue);
45 void async_queue_enable (AsyncQueue * queue);
46 void async_queue_flush (AsyncQueue * queue);
47
48 #endif /* ASYNC_QUEUE_H */