36
37
<th width="100%" align="center">GLib Reference Manual</th>
37
38
<td><a accesskey="n" href="glib-Dynamic-Loading-of-Modules.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
39
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2966151" class="shortcut">Top</a>
41
<a href="#id2966777" class="shortcut">Description</a></nobr></td></tr>
40
<tr><td colspan="5" class="shortcuts">
41
<a href="#glib-Asynchronous-Queues.synopsis" class="shortcut">Top</a>
43
<a href="#glib-Asynchronous-Queues.description" class="shortcut">Description</a>
43
46
<div class="refentry" lang="en">
44
47
<a name="glib-Asynchronous-Queues"></a><div class="titlepage"></div>
45
48
<div class="refnamediv"><table width="100%"><tr>
48
<a name="id2966151"></a><span class="refentrytitle">Asynchronous Queues</span>
50
<p>Asynchronous Queues — asynchronous communication between threads</p>
50
<h2><span class="refentrytitle"><a name="glib-Asynchronous-Queues.top_of_page"></a>Asynchronous Queues</span></h2>
51
<p>Asynchronous Queues — asynchronous communication between threads</p>
52
53
<td valign="top" align="right"></td>
53
54
</tr></table></div>
54
55
<div class="refsynopsisdiv">
56
<a name="glib-Asynchronous-Queues.synopsis"></a><h2>Synopsis</h2>
56
57
<pre class="synopsis">
58
59
#include <glib.h>
61
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>;
62
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>* <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-new">g_async_queue_new</a> (void);
63
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>* <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-new-full">g_async_queue_new_full</a> (<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> item_free_func);
64
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>* <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-ref">g_async_queue_ref</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
65
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref">g_async_queue_unref</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
66
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push">g_async_queue_push</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
67
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
68
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push-sorted">g_async_queue_push_sorted</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
69
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
70
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> func,
71
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
72
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-pop">g_async_queue_pop</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
73
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-try-pop">g_async_queue_try_pop</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
74
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-timed-pop">g_async_queue_timed_pop</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
75
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal">GTimeVal</a> *end_time);
76
<a class="link" href="glib-Basic-Types.html#gint">gint</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-length">g_async_queue_length</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
77
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-sort">g_async_queue_sort</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
78
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> func,
79
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
81
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-lock">g_async_queue_lock</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
82
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unlock">g_async_queue_unlock</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
83
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-ref-unlocked">g_async_queue_ref_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
84
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref-and-unlock">g_async_queue_unref_and_unlock</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
85
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push-unlocked">g_async_queue_push_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
86
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
87
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push-sorted-unlocked">g_async_queue_push_sorted_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
88
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
89
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> func,
90
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
91
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-pop-unlocked">g_async_queue_pop_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
92
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-try-pop-unlocked">g_async_queue_try_pop_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
93
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-timed-pop-unlocked">g_async_queue_timed_pop_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
94
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal">GTimeVal</a> *end_time);
95
<a class="link" href="glib-Basic-Types.html#gint">gint</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-length-unlocked">g_async_queue_length_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);
96
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-sort-unlocked">g_async_queue_sort_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
97
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> func,
98
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
61
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>;
62
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>* <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-new" title="g_async_queue_new ()">g_async_queue_new</a> (void);
63
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>* <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-new-full" title="g_async_queue_new_full ()">g_async_queue_new_full</a> (<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> item_free_func);
64
<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>* <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-ref" title="g_async_queue_ref ()">g_async_queue_ref</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
65
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref" title="g_async_queue_unref ()">g_async_queue_unref</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
66
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push" title="g_async_queue_push ()">g_async_queue_push</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
67
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data);
68
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push-sorted" title="g_async_queue_push_sorted ()">g_async_queue_push_sorted</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
69
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
70
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()">GCompareDataFunc</a> func,
71
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
72
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-pop" title="g_async_queue_pop ()">g_async_queue_pop</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
73
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-try-pop" title="g_async_queue_try_pop ()">g_async_queue_try_pop</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
74
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-timed-pop" title="g_async_queue_timed_pop ()">g_async_queue_timed_pop</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
75
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal">GTimeVal</a> *end_time);
76
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-length" title="g_async_queue_length ()">g_async_queue_length</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
77
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-sort" title="g_async_queue_sort ()">g_async_queue_sort</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
78
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()">GCompareDataFunc</a> func,
79
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
81
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-lock" title="g_async_queue_lock ()">g_async_queue_lock</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
82
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unlock" title="g_async_queue_unlock ()">g_async_queue_unlock</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
83
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-ref-unlocked" title="g_async_queue_ref_unlocked ()">g_async_queue_ref_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
84
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref-and-unlock" title="g_async_queue_unref_and_unlock ()">g_async_queue_unref_and_unlock</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
85
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push-unlocked" title="g_async_queue_push_unlocked ()">g_async_queue_push_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
86
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data);
87
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push-sorted-unlocked" title="g_async_queue_push_sorted_unlocked ()">g_async_queue_push_sorted_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
88
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
89
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()">GCompareDataFunc</a> func,
90
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
91
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-pop-unlocked" title="g_async_queue_pop_unlocked ()">g_async_queue_pop_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
92
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-try-pop-unlocked" title="g_async_queue_try_pop_unlocked ()">g_async_queue_try_pop_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
93
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-timed-pop-unlocked" title="g_async_queue_timed_pop_unlocked ()">g_async_queue_timed_pop_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
94
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal">GTimeVal</a> *end_time);
95
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-length-unlocked" title="g_async_queue_length_unlocked ()">g_async_queue_length_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);
96
void <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-sort-unlocked" title="g_async_queue_sort_unlocked ()">g_async_queue_sort_unlocked</a> (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
97
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()">GCompareDataFunc</a> func,
98
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
101
101
<div class="refsect1" lang="en">
102
<a name="id2966777"></a><h2>Description</h2>
102
<a name="glib-Asynchronous-Queues.description"></a><h2>Description</h2>
104
104
Often you need to communicate between different threads. In general
105
105
it's safer not to do this by shared memory, but by explicit message
118
118
For using an asynchronous queue you first have to create one with
119
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-new"><code class="function">g_async_queue_new()</code></a>. A newly-created queue will get the reference
119
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-new" title="g_async_queue_new ()"><code class="function">g_async_queue_new()</code></a>. A newly-created queue will get the reference
120
120
count 1. Whenever another thread is creating a new reference of (that
121
121
is, pointer to) the queue, it has to increase the reference count
122
(using <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-ref"><code class="function">g_async_queue_ref()</code></a>). Also, before removing this reference, the
122
(using <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-ref" title="g_async_queue_ref ()"><code class="function">g_async_queue_ref()</code></a>). Also, before removing this reference, the
123
123
reference count has to be decreased (using
124
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref"><code class="function">g_async_queue_unref()</code></a>). After that the queue might no longer exist so
124
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref" title="g_async_queue_unref ()"><code class="function">g_async_queue_unref()</code></a>). After that the queue might no longer exist so
125
125
you must not access it after that point.
128
128
A thread, which wants to send a message to that queue simply calls
129
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push"><code class="function">g_async_queue_push()</code></a> to push the message to the queue.
129
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-push" title="g_async_queue_push ()"><code class="function">g_async_queue_push()</code></a> to push the message to the queue.
132
132
A thread, which is expecting messages from an asynchronous queue
133
simply calls <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-pop"><code class="function">g_async_queue_pop()</code></a> for that queue. If no message is
133
simply calls <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-pop" title="g_async_queue_pop ()"><code class="function">g_async_queue_pop()</code></a> for that queue. If no message is
134
134
available in the queue at that point, the thread is now put to sleep
135
135
until a message arrives. The message will be removed from the queue
136
and returned. The functions <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-try-pop"><code class="function">g_async_queue_try_pop()</code></a> and
137
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-timed-pop"><code class="function">g_async_queue_timed_pop()</code></a> can be used to only check for the presence
136
and returned. The functions <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-try-pop" title="g_async_queue_try_pop ()"><code class="function">g_async_queue_try_pop()</code></a> and
137
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-timed-pop" title="g_async_queue_timed_pop ()"><code class="function">g_async_queue_timed_pop()</code></a> can be used to only check for the presence
138
138
of messages or to only wait a certain time for messages respectively.
141
141
For almost every function there exist two variants, one that locks the
142
142
queue and one that doesn't. That way you can hold the queue lock
143
(acquire it with <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-lock"><code class="function">g_async_queue_lock()</code></a> and release it with
144
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unlock"><code class="function">g_async_queue_unlock()</code></a>) over multiple queue accessing
143
(acquire it with <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-lock" title="g_async_queue_lock ()"><code class="function">g_async_queue_lock()</code></a> and release it with
144
<a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unlock" title="g_async_queue_unlock ()"><code class="function">g_async_queue_unlock()</code></a>) over multiple queue accessing
145
145
instructions. This can be necessary to ensure the integrity of the
146
146
queue, but should only be used when really necessary, as it can make
147
147
your life harder if used unwisely. Normally you should only use the
151
151
<div class="refsect1" lang="en">
152
<a name="id2966938"></a><h2>Details</h2>
152
<a name="glib-Asynchronous-Queues.details"></a><h2>Details</h2>
153
153
<div class="refsect2" lang="en">
154
<a name="id2966948"></a><h3>
155
<a name="GAsyncQueue"></a>GAsyncQueue</h3>
156
<a class="indexterm" name="id2966960"></a><pre class="programlisting">typedef struct _GAsyncQueue GAsyncQueue;</pre>
154
<a name="GAsyncQueue"></a><h3>GAsyncQueue</h3>
155
<pre class="programlisting">typedef struct _GAsyncQueue GAsyncQueue;</pre>
158
The <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a> struct is an opaque data structure, which represents
157
The <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a> struct is an opaque data structure, which represents
159
158
an asynchronous queue. It should only be accessed through the
160
159
<code class="function">g_async_queue_*</code> functions.
164
163
<div class="refsect2" lang="en">
165
<a name="id2966992"></a><h3>
166
<a name="g-async-queue-new"></a>g_async_queue_new ()</h3>
167
<a class="indexterm" name="id2967006"></a><pre class="programlisting"><a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>* g_async_queue_new (void);</pre>
164
<a name="g-async-queue-new"></a><h3>g_async_queue_new ()</h3>
165
<pre class="programlisting"><a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>* g_async_queue_new (void);</pre>
169
167
Creates a new asynchronous queue with the initial reference count of 1.</p>
170
168
<div class="variablelist"><table border="0">
171
169
<col align="left" valign="top">
173
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
174
<td> the new <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
171
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
172
<td> the new <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
180
178
<div class="refsect2" lang="en">
181
<a name="id2967052"></a><h3>
182
<a name="g-async-queue-new-full"></a>g_async_queue_new_full ()</h3>
183
<a class="indexterm" name="id2967067"></a><pre class="programlisting"><a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>* g_async_queue_new_full (<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> item_free_func);</pre>
179
<a name="g-async-queue-new-full"></a><h3>g_async_queue_new_full ()</h3>
180
<pre class="programlisting"><a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>* g_async_queue_new_full (<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> item_free_func);</pre>
185
182
Creates a new asynchronous queue with an initial reference count of 1 and
186
183
sets up a destroy notify function that is used to free any remaining
187
184
queue items when the queue is destroyed after the final unref.</p>
191
187
<div class="variablelist"><table border="0">
192
188
<col align="left" valign="top">
195
<td><p><span class="term"><em class="parameter"><code>item_free_func</code></em> :</span></p></td>
191
<td><p><span class="term"><em class="parameter"><code>item_free_func</code></em> :</span></p></td>
196
192
<td> function to free queue elements
200
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
201
<td> the new <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
196
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
197
<td> the new <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
207
<p class="since">Since 2.16
203
<p class="since">Since 2.16</p>
211
206
<div class="refsect2" lang="en">
212
<a name="id2967147"></a><h3>
213
<a name="g-async-queue-ref"></a>g_async_queue_ref ()</h3>
214
<a class="indexterm" name="id2967160"></a><pre class="programlisting"><a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a>* g_async_queue_ref (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);</pre>
207
<a name="g-async-queue-ref"></a><h3>g_async_queue_ref ()</h3>
208
<pre class="programlisting"><a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a>* g_async_queue_ref (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);</pre>
216
210
Increases the reference count of the asynchronous <em class="parameter"><code>queue</code></em> by 1. You
217
211
do not need to hold the lock to call this function.</p>
245
238
<div class="variablelist"><table border="0">
246
239
<col align="left" valign="top">
248
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
249
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
241
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
242
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
255
248
<div class="refsect2" lang="en">
256
<a name="id2967330"></a><h3>
257
<a name="g-async-queue-push"></a>g_async_queue_push ()</h3>
258
<a class="indexterm" name="id2967343"></a><pre class="programlisting">void g_async_queue_push (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
259
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
249
<a name="g-async-queue-push"></a><h3>g_async_queue_push ()</h3>
250
<pre class="programlisting">void g_async_queue_push (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
251
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data);</pre>
261
Pushes the <em class="parameter"><code>data</code></em> into the <em class="parameter"><code>queue</code></em>. <em class="parameter"><code>data</code></em> must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p>
253
Pushes the <em class="parameter"><code>data</code></em> into the <em class="parameter"><code>queue</code></em>. <em class="parameter"><code>data</code></em> must not be <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
262
254
<div class="variablelist"><table border="0">
263
255
<col align="left" valign="top">
266
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
267
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
258
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
259
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
271
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
263
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
272
264
<td> <em class="parameter"><code>data</code></em> to push into the <em class="parameter"><code>queue</code></em>.
385
372
<div class="refsect2" lang="en">
386
<a name="id2967911"></a><h3>
387
<a name="g-async-queue-timed-pop"></a>g_async_queue_timed_pop ()</h3>
388
<a class="indexterm" name="id2967924"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_async_queue_timed_pop (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
389
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal">GTimeVal</a> *end_time);</pre>
373
<a name="g-async-queue-timed-pop"></a><h3>g_async_queue_timed_pop ()</h3>
374
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> g_async_queue_timed_pop (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
375
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal">GTimeVal</a> *end_time);</pre>
391
377
Pops data from the <em class="parameter"><code>queue</code></em>. If no data is received before <em class="parameter"><code>end_time</code></em>,
392
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.
378
<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
395
To easily calculate <em class="parameter"><code>end_time</code></em> a combination of <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time"><code class="function">g_get_current_time()</code></a>
396
and <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-add"><code class="function">g_time_val_add()</code></a> can be used.</p>
381
To easily calculate <em class="parameter"><code>end_time</code></em> a combination of <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time" title="g_get_current_time ()"><code class="function">g_get_current_time()</code></a>
382
and <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-add" title="g_time_val_add ()"><code class="function">g_time_val_add()</code></a> can be used.</p>
397
383
<div class="variablelist"><table border="0">
398
384
<col align="left" valign="top">
401
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
402
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
406
<td><p><span class="term"><em class="parameter"><code>end_time</code></em> :</span></p></td>
407
<td> a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal"><span class="type">GTimeVal</span></a>, determining the final time.
411
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
412
<td> data from the queue or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, when no data is
387
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
388
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
392
<td><p><span class="term"><em class="parameter"><code>end_time</code></em> :</span></p></td>
393
<td> a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal"><span class="type">GTimeVal</span></a>, determining the final time.
397
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
398
<td> data from the queue or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, when no data is
413
399
received before <em class="parameter"><code>end_time</code></em>.
515
496
<div class="variablelist"><table border="0">
516
497
<col align="left" valign="top">
518
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
519
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
499
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
500
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
525
506
<div class="refsect2" lang="en">
526
<a name="id2968488"></a><h3>
527
<a name="g-async-queue-unlock"></a>g_async_queue_unlock ()</h3>
528
<a class="indexterm" name="id2968501"></a><pre class="programlisting">void g_async_queue_unlock (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);</pre>
507
<a name="g-async-queue-unlock"></a><h3>g_async_queue_unlock ()</h3>
508
<pre class="programlisting">void g_async_queue_unlock (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);</pre>
530
510
Releases the queue's lock.</p>
531
511
<div class="variablelist"><table border="0">
532
512
<col align="left" valign="top">
534
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
535
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
514
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
515
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
541
521
<div class="refsect2" lang="en">
542
<a name="id2968557"></a><h3>
543
<a name="g-async-queue-ref-unlocked"></a>g_async_queue_ref_unlocked ()</h3>
544
<a class="indexterm" name="id2968573"></a><pre class="programlisting">void g_async_queue_ref_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue);</pre>
522
<a name="g-async-queue-ref-unlocked"></a><h3>g_async_queue_ref_unlocked ()</h3>
523
<pre class="programlisting">void g_async_queue_ref_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue);</pre>
545
524
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
546
525
<h3 class="title">Warning</h3>
547
526
<p><code class="literal">g_async_queue_ref_unlocked</code> is deprecated and should not be used in newly-written code.</p>
581
559
<em class="parameter"><code>Deprecated</code></em>: Since 2.8, reference counting is done atomically
582
so <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref"><code class="function">g_async_queue_unref()</code></a> can be used regardless of the <em class="parameter"><code>queue</code></em>'s
560
so <a class="link" href="glib-Asynchronous-Queues.html#g-async-queue-unref" title="g_async_queue_unref ()"><code class="function">g_async_queue_unref()</code></a> can be used regardless of the <em class="parameter"><code>queue</code></em>'s
584
562
<div class="variablelist"><table border="0">
585
563
<col align="left" valign="top">
587
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
588
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
565
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
566
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
594
572
<div class="refsect2" lang="en">
595
<a name="id2968807"></a><h3>
596
<a name="g-async-queue-push-unlocked"></a>g_async_queue_push_unlocked ()</h3>
597
<a class="indexterm" name="id2968821"></a><pre class="programlisting">void g_async_queue_push_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
598
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
573
<a name="g-async-queue-push-unlocked"></a><h3>g_async_queue_push_unlocked ()</h3>
574
<pre class="programlisting">void g_async_queue_push_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
575
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data);</pre>
600
Pushes the <em class="parameter"><code>data</code></em> into the <em class="parameter"><code>queue</code></em>. <em class="parameter"><code>data</code></em> must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. This
577
Pushes the <em class="parameter"><code>data</code></em> into the <em class="parameter"><code>queue</code></em>. <em class="parameter"><code>data</code></em> must not be <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>. This
601
578
function must be called while holding the <em class="parameter"><code>queue</code></em>'s lock.</p>
602
579
<div class="variablelist"><table border="0">
603
580
<col align="left" valign="top">
606
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
607
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
583
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
584
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
611
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
588
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
612
589
<td> <em class="parameter"><code>data</code></em> to push into the <em class="parameter"><code>queue</code></em>.
726
698
<div class="refsect2" lang="en">
727
<a name="id2969410"></a><h3>
728
<a name="g-async-queue-timed-pop-unlocked"></a>g_async_queue_timed_pop_unlocked ()</h3>
729
<a class="indexterm" name="id2969424"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_async_queue_timed_pop_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
730
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal">GTimeVal</a> *end_time);</pre>
699
<a name="g-async-queue-timed-pop-unlocked"></a><h3>g_async_queue_timed_pop_unlocked ()</h3>
700
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> g_async_queue_timed_pop_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
701
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal">GTimeVal</a> *end_time);</pre>
732
703
Pops data from the <em class="parameter"><code>queue</code></em>. If no data is received before <em class="parameter"><code>end_time</code></em>,
733
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned. This function must be called while holding the
704
<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> is returned. This function must be called while holding the
734
705
<em class="parameter"><code>queue</code></em>'s lock.
737
To easily calculate <em class="parameter"><code>end_time</code></em> a combination of <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time"><code class="function">g_get_current_time()</code></a>
738
and <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-add"><code class="function">g_time_val_add()</code></a> can be used.</p>
708
To easily calculate <em class="parameter"><code>end_time</code></em> a combination of <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time" title="g_get_current_time ()"><code class="function">g_get_current_time()</code></a>
709
and <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-add" title="g_time_val_add ()"><code class="function">g_time_val_add()</code></a> can be used.</p>
739
710
<div class="variablelist"><table border="0">
740
711
<col align="left" valign="top">
743
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
744
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
748
<td><p><span class="term"><em class="parameter"><code>end_time</code></em> :</span></p></td>
749
<td> a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal"><span class="type">GTimeVal</span></a>, determining the final time.
753
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
754
<td> data from the queue or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, when no data is
714
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
715
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>.
719
<td><p><span class="term"><em class="parameter"><code>end_time</code></em> :</span></p></td>
720
<td> a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal"><span class="type">GTimeVal</span></a>, determining the final time.
724
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
725
<td> data from the queue or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, when no data is
755
726
received before <em class="parameter"><code>end_time</code></em>.
792
762
<div class="refsect2" lang="en">
793
<a name="id2969706"></a><h3>
794
<a name="g-async-queue-sort-unlocked"></a>g_async_queue_sort_unlocked ()</h3>
795
<a class="indexterm" name="id2969723"></a><pre class="programlisting">void g_async_queue_sort_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue">GAsyncQueue</a> *queue,
796
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> func,
797
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
763
<a name="g-async-queue-sort-unlocked"></a><h3>g_async_queue_sort_unlocked ()</h3>
764
<pre class="programlisting">void g_async_queue_sort_unlocked (<a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue">GAsyncQueue</a> *queue,
765
<a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()">GCompareDataFunc</a> func,
766
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);</pre>
799
768
Sorts <em class="parameter"><code>queue</code></em> using <em class="parameter"><code>func</code></em>.
802
771
This function is called while holding the <em class="parameter"><code>queue</code></em>'s lock.</p>
806
774
<div class="variablelist"><table border="0">
807
775
<col align="left" valign="top">
810
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
811
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a>
778
<td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td>
779
<td> a <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>
815
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
816
<td> the <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc"><span class="type">GCompareDataFunc</span></a> is used to sort <em class="parameter"><code>queue</code></em>. This
783
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
784
<td> the <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()"><span class="type">GCompareDataFunc</span></a> is used to sort <em class="parameter"><code>queue</code></em>. This
817
785
function is passed two elements of the <em class="parameter"><code>queue</code></em>. The function
818
786
should return 0 if they are equal, a negative value if the
819
787
first element should be higher in the <em class="parameter"><code>queue</code></em> or a positive