AsyncQueue

The GAsyncQueue struct is an opaque data structure which represents an asynchronous queue. It should only be accessed through the g_async_queue_* functions.

Constructors

this
this(GAsyncQueue* gAsyncQueue, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new asynchronous queue.

this
this(GDestroyNotify itemFreeFunc)

Creates a new asynchronous queue and sets up a destroy notify function that is used to free any remaining queue items when the queue is destroyed after the final unref.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

getAsyncQueueStruct
GAsyncQueue* getAsyncQueueStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

length
int length()

Returns the length of the queue.

lengthUnlocked
int lengthUnlocked()

Returns the length of the queue.

lock
void lock()

Acquires the queue's lock. If another thread is already holding the lock, this call will block until the lock becomes available.

pop
void* pop()

Pops data from the queue. If queue is empty, this function blocks until data becomes available.

popUnlocked
void* popUnlocked()

Pops data from the queue. If queue is empty, this function blocks until data becomes available.

push
void push(void* data)

Pushes the data into the queue. data must not be NULL.

pushFront
void pushFront(void* item)

Pushes the item into the queue. item must not be NULL. In contrast to AsyncQueue.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.

pushFrontUnlocked
void pushFrontUnlocked(void* item)

Pushes the item into the queue. item must not be NULL. In contrast to AsyncQueue.pushUnlocked, 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.

pushSorted
void pushSorted(void* data, GCompareDataFunc func, void* userData)

Inserts data into queue using func to determine the new position.

pushSortedUnlocked
void pushSortedUnlocked(void* data, GCompareDataFunc func, void* userData)

Inserts data into queue using func to determine the new position.

pushUnlocked
void pushUnlocked(void* data)

Pushes the data into the queue. data must not be NULL.

refUnlocked
void refUnlocked()

Increases the reference count of the asynchronous queue by 1.

ref_
AsyncQueue ref_()

Increases the reference count of the asynchronous queue by 1. You do not need to hold the lock to call this function.

remove
bool remove(void* item)

Remove an item from the queue.

removeUnlocked
bool removeUnlocked(void* item)

Remove an item from the queue.

sort
void sort(GCompareDataFunc func, void* userData)

Sorts queue using func.

sortUnlocked
void sortUnlocked(GCompareDataFunc func, void* userData)

Sorts queue using func.

timedPop
void* timedPop(TimeVal endTime)

Pops data from the queue. If the queue is empty, blocks until end_time or until data becomes available.

timedPopUnlocked
void* timedPopUnlocked(TimeVal endTime)

Pops data from the queue. If the queue is empty, blocks until end_time or until data becomes available.

timeoutPop
void* timeoutPop(ulong timeout)

Pops data from the queue. If the queue is empty, blocks for timeout microseconds, or until data becomes available.

timeoutPopUnlocked
void* timeoutPopUnlocked(ulong timeout)

Pops data from the queue. If the queue is empty, blocks for timeout microseconds, or until data becomes available.

tryPop
void* tryPop()

Tries to pop data from the queue. If no data is available, NULL is returned.

tryPopUnlocked
void* tryPopUnlocked()

Tries to pop data from the queue. If no data is available, NULL is returned.

unlock
void unlock()

Releases the queue's lock.

unref
void unref()

Decreases the reference count of the asynchronous queue by 1.

unrefAndUnlock
void unrefAndUnlock()

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.

Variables

gAsyncQueue
GAsyncQueue* gAsyncQueue;

the main Gtk struct