remove


Description:

public static bool remove (uint id)

Removes the source with the given ID from the default main context.

You must use [method@GLib.Source.destroy] for sources added to a non-default main context.

The ID of a [struct@GLib.Source] is given by [method@GLib.Source.get_id], or will be returned by the functions [method@GLib.Source.attach], [ func@GLib.idle_add], [func@GLib.idle_add_full], [func@GLib.timeout_add], [func@GLib.timeout_add_full], [func@GLib.child_watch_add], [ func@GLib.child_watch_add_full], [func@GLib.io_add_watch], and [func@GLib.io_add_watch_full].

It is a programmer error to attempt to remove a non-existent source.

More specifically: source IDs can be reissued after a source has been destroyed and therefore it is never valid to use this function with a source ID which may have already been removed. An example is when scheduling an idle to run in another thread with [func@GLib.idle_add]: the idle may already have run and been removed by the time this function is called on its (now invalid) source ID. This source ID may have been reissued, leading to the operation being performed against the wrong source.

Parameters:

tag

the ID of the source to remove.

Returns:

true if the source was found and removed, false otherwise