SwamiControlQueue

SwamiControlQueue

Synopsis

gboolean            (*SwamiControlQueueTestFunc)        (SwamiControlQueue *queue,
                                                         SwamiControl *control,
                                                         SwamiControlEvent *event);
                    SwamiControlQueue;
SwamiControlQueue * swami_control_queue_new             (void);
void                swami_control_queue_add_event       (SwamiControlQueue *queue,
                                                         SwamiControl *control,
                                                         SwamiControlEvent *event);
void                swami_control_queue_run             (SwamiControlQueue *queue);
void                swami_control_queue_set_test_func   (SwamiControlQueue *queue,
                                                         SwamiControlQueueTestFunc test_func);

Object Hierarchy

  GObject
   +----SwamiLock
         +----SwamiControlQueue

Description

Details

SwamiControlQueueTestFunc ()

gboolean            (*SwamiControlQueueTestFunc)        (SwamiControlQueue *queue,
                                                         SwamiControl *control,
                                                         SwamiControlEvent *event);

A callback function type used to test if an event should be added to a queue. An example of its usage would be a GUI queue which could test to see if the event is being sent within the GUI thread or not.

queue :

The queue object

control :

The control

event :

The control event

Returns :

Function should return TRUE if event should be queued, FALSE to send event immediately.

SwamiControlQueue

typedef struct _SwamiControlQueue SwamiControlQueue;

swami_control_queue_new ()

SwamiControlQueue * swami_control_queue_new             (void);

Create a new control queue object. These are used to queue control events which can then be run at a later time (within a GUI thread for example).

Returns :

New control queue with a ref count of 1 that the caller owns.

swami_control_queue_add_event ()

void                swami_control_queue_add_event       (SwamiControlQueue *queue,
                                                         SwamiControl *control,
                                                         SwamiControlEvent *event);

Adds a control event to a queue. Does not run queue test function this is the responsibility of the caller (for added performance).

queue :

Swami control queue object

control :

Control to queue an event for

event :

Control event to queue

swami_control_queue_run ()

void                swami_control_queue_run             (SwamiControlQueue *queue);

Process a control event queue by sending queued events to controls.

queue :

Swami control queue object

swami_control_queue_set_test_func ()

void                swami_control_queue_set_test_func   (SwamiControlQueue *queue,
                                                         SwamiControlQueueTestFunc test_func);

Set the queue test function which is called for each event added (and should therefore be fast) to determine if the event should be queued or sent immediately. Note that swami_control_queue_add_event() doesn't run the test function, that is up to the caller (for increased performance).

queue :

Control queue object

test_func :

Test function callback (function should return TRUE to queue an event or FALSE to send immediately), can be NULL in which case all events are queued (the default).