add_full


Description:

public uint add_full (int priority, owned SourceFunc function)

Adds a function to be called whenever there are no higher priority events pending.

If the function returns [const@GLib.SOURCE_REMOVE] it is automatically removed from the list of event sources and will not be called again.

See [main loop memory management](main-loop.html#memory-management-of-sources) for details on how to handle the return value and memory management of data.

This internally creates a main loop source using [func@GLib.idle_source_new] and attaches it to the global [struct@GLib.MainContext] using [ method@GLib.Source.attach], so the callback will be invoked in whichever thread is running that main context. You can do these steps manually if you need greater control or to use a custom main context.

Parameters:

priority

the priority of the idle source; typically this will be in the range between [const@GLib.PRIORITY_DEFAULT_IDLE] and [ const@GLib.PRIORITY_HIGH_IDLE]

function

function to call

data

data to pass to function

notify

function to call when the idle is removed

Returns:

the ID (greater than 0) of the event source


Namespace: GLib.Idle
Package: glib-2.0