rb-async-queue-watch

rb-async-queue-watch — GSource for watching a GAsyncQueue in the main loop

Functions

Description

This provides a way to feed work items to the main loop using a GAsyncQueue without polling it.

Functions

RBAsyncQueueWatchFunc ()

void
(*RBAsyncQueueWatchFunc) (gpointer item,
                          gpointer data);

Callback to call when an item is found in the queue.

Parameters

item

the item found in the queue

 

data

user data specified when creating the watch

 

rb_async_queue_watch_new ()

guint
rb_async_queue_watch_new (GAsyncQueue *queue,
                          gint priority,
                          RBAsyncQueueWatchFunc callback,
                          gpointer user_data,
                          GDestroyNotify notify,
                          GMainContext *context);

Creates a new GSource that triggers when the GAsyncQueue is non-empty. This is used in rhythmbox to process queues within RhythmDB in the main thread without polling.

Parameters

queue

the GAsyncQueue to watch

 

priority

priority value for the GSource

 

callback

callback to invoke when the queue is non-empty

 

user_data

user data to pass to the callback

 

notify

function to call to clean up the user data for the callback

 

context

the GMainContext to attach the source to

 

Returns

the ID of the new GSource