Project:DUI

Class List Class Hierarchy
Summary: Ctors Methods Mixins

Module dglib.AQueue

Class AQueue

Implemented interfaces:


public class

AQueue



Asyncronous Queues, can be used to communicate between threads

Constructor Summary
(GAsyncQueue* gAsyncQueue)
          
public ()
          Get a new GAsyncQueue with the ref_count 1

Methods Summary
void lock()
          Lock AQueue.
void unlock()
          UnLock AQueue.
void ref()
          /* Ref and unref the GAsyncQueue.
void refUnlocked()
          
void unref()
          
void unrefAndUnlock()
          
void push(void* data)
          /* Push data into the async queue.
void pushUnlocked(void* data)
          
gpointer pop()
          /* Pop data from the async queue.
gpointer popUnlocked()
          
gpointer tryPop()
          /* Try to pop data.
gpointer tryPopUnlock()
          
gpointer timedPop(GTimeVal *end_time)
          /* Wait for data until at maximum until end_time is reached.
gpointer timedPopUnlocked(GTimeVal *end_time)
          
gint length()
          /* Return the length of the queue.
gint lengthUnlocked()
          




ctor(AQueue)(GAsyncQueue* gAsyncQueue)



public ctor(AQueue)()
Get a new GAsyncQueue with the ref_count 1

lock

void lock()
Lock AQueue.
All functions lock the queue for themselves, but in certain cirumstances you want to hold the lock longer, thus you lock the queue, call the *_unlocked functions and unlock it again.

unlock

void unlock()
UnLock AQueue.
All functions lock the queue for themselves, but in certain cirumstances you want to hold the lock longer, thus you lock the queue, call the *_unlocked functions and unlock it again.

ref

void ref()
/* Ref and unref the GAsyncQueue.
g_async_queue_unref_unlocked makes no sense, as after the unreffing the Queue might be gone and can't be unlocked. So you have a function to call, if you don't hold the lock (g_async_queue_unref) and one to call, when you already hold the lock (g_async_queue_unref_and_unlock). After that however, you don't hold the lock anymore and the Queue might in fact be destroyed, if you unrefed to zero.

refUnlocked

void refUnlocked()

unref

void unref()

unrefAndUnlock

void unrefAndUnlock()

push

void push(void* data)
/* Push data into the async queue.
Must not be NULL.

pushUnlocked

void pushUnlocked(void* data)

pop

gpointer pop()
/* Pop data from the async queue.
When no data is there, the thread is blocked until data arrives.

popUnlocked

gpointer popUnlocked()

tryPop

gpointer tryPop()
/* Try to pop data.
NULL is returned in case of empty queue.

tryPopUnlock

gpointer tryPopUnlock()

timedPop

gpointer timedPop(GTimeVal *end_time)
/* Wait for data until at maximum until end_time is reached.
NULL is returned in case of empty queue.

timedPopUnlocked

gpointer timedPopUnlocked(GTimeVal *end_time)

length

gint length()
/* Return the length of the queue.
Negative values mean that threads are waiting, positve values mean that there are entries in the queue. Actually this function returns the length of the queue minus the number of waiting threads, g_async_queue_length == 0 could also mean 'n' entries in the queue and 'n' thread waiting. Such can happen due to locking of the queue or due to scheduling.

lengthUnlocked

gint lengthUnlocked()