Returns the length of the queue.
Actually this function returns the number of data items in
the queue minus the number of waiting threads, so a negative
value means waiting threads, and a positive value means available
entries in the queue
. A return value of 0 could mean n entries
in the queue and n threads waiting. This can happen due to locking
of the queue or due to scheduling.
Returns the length of the queue.
Actually this function returns the number of data items in
the queue minus the number of waiting threads, so a negative
value means waiting threads, and a positive value means available
entries in the queue
. A return value of 0 could mean n entries
in the queue and n threads waiting. This can happen due to locking
of the queue or due to scheduling.
This function must be called while holding the queue'
s lock.
Acquires the queue'
s lock. If another thread is already
holding the lock, this call will block until the lock
becomes available.
Call g_async_queue_unlock() to drop the lock again.
While holding the lock, you can only call the
g_async_queue_*_unlocked() functions on queue
. Otherwise,
deadlock may occur.
Pops data from the queue
. If queue
is empty, this function
blocks until data becomes available.
Pops data from the queue
. If queue
is empty, this function
blocks until data becomes available.
This function must be called while holding the queue'
s lock.
Pushes the data
into the queue
. data
must not be %NULL.
data
to push into the queue
Pushes the item
into the queue
. item
must not be %NULL.
In contrast to g_async_queue_push(), this function
pushes the new item ahead of the items already in the queue,
so that it will be the next one to be popped off the queue.
data to push into the queue
Pushes the item
into the queue
. item
must not be %NULL.
In contrast to g_async_queue_push_unlocked(), this function
pushes the new item ahead of the items already in the queue,
so that it will be the next one to be popped off the queue.
This function must be called while holding the queue'
s lock.
data to push into the queue
Pushes the data
into the queue
. data
must not be %NULL.
This function must be called while holding the queue'
s lock.
data
to push into the queue
Increases the reference count of the asynchronous queue
by 1.
Remove an item from the queue.
the data to remove from the queue
Remove an item from the queue.
This function must be called while holding the queue'
s lock.
the data to remove from the queue
Pops data from the queue
. If the queue is empty, blocks until
end_time
or until data becomes available.
If no data is received before end_time,
%NULL is returned.
To easily calculate end_time,
a combination of g_get_real_time()
and g_time_val_add() can be used.
a #GTimeVal, determining the final time
Pops data from the queue
. If the queue is empty, blocks until
end_time
or until data becomes available.
If no data is received before end_time,
%NULL is returned.
To easily calculate end_time,
a combination of g_get_real_time()
and g_time_val_add() can be used.
This function must be called while holding the queue'
s lock.
a #GTimeVal, determining the final time
Pops data from the queue
. If the queue is empty, blocks for
timeout
microseconds, or until data becomes available.
If no data is received before the timeout, %NULL is returned.
the number of microseconds to wait
Pops data from the queue
. If the queue is empty, blocks for
timeout
microseconds, or until data becomes available.
If no data is received before the timeout, %NULL is returned.
This function must be called while holding the queue'
s lock.
the number of microseconds to wait
Tries to pop data from the queue
. If no data is available,
%NULL is returned.
Tries to pop data from the queue
. If no data is available,
%NULL is returned.
This function must be called while holding the queue'
s lock.
Releases the queue's lock.
Calling this function when you have not acquired the with g_async_queue_lock() leads to undefined behaviour.
Decreases the reference count of the asynchronous queue
by 1.
If the reference count went to 0, the queue
will be destroyed
and the memory allocated will be freed. So you are not allowed
to use the queue
afterwards, as it might have disappeared.
You do not need to hold the lock to call this function.
Decreases the reference count of the asynchronous queue
by 1
and releases the lock. This function must be called while holding
the queue'
s lock. If the reference count went to 0, the queue
will be destroyed and the memory allocated will be freed.
An opaque data structure which represents an asynchronous queue.
It should only be accessed through the
g_async_queue_*
functions.