Source
Object Hierarchy:
Description:
[ Compact ]
[ CCode ( ref_function = "g_source_ref" , type_id = "G_TYPE_SOURCE" , unref_function = "g_source_unref" ) ]
public abstract class Source
[ CCode ( ref_function = "g_source_ref" , type_id = "G_TYPE_SOURCE" , unref_function = "g_source_unref" ) ]
public abstract class Source
All known sub-classes:
Namespace: GLib
Package: glib-2.0
Content:
Constants:
- public const bool CONTINUE
Use this macro as the return value of a SourceFunc to leave the SignalSource in the main loop.
- public const bool REMOVE
Use this macro as the return value of a SourceFunc to remove the SignalSource from the main loop.
Static methods:
- public static bool remove (uint id)
Removes the source with the given ID from the default main context.
- public static bool remove_by_funcs_user_data (SourceFuncs funcs, void* user_data)
Removes a source from the default main loop context given the source functions and user data.
- public static bool remove_by_user_data (void* user_data)
Removes a source from the default main loop context given the user data for the callback.
- public static void set_name_by_id (uint tag, string? name)
Sets the name of a source using its ID.
Creation methods:
- protected Source ()
Creates a new SignalSource structure.
Methods:
- public void add_child_source (Source child_source)
Adds
child_source
to this as a "polled" source; when this is added to a MainContext,child_source
will be automatically added with the same priority, whenchild_source
is triggered, it will cause this to dispatch (in addition to calling its own callback), and when this is destroyed, it will destroychild_source
as well. - public void add_poll (ref PollFD fd)
Adds a file descriptor to the set of file descriptors polled for this source.
- public void* add_unix_fd (int fd, IOCondition events)
Monitors
fd
for the IO events inevents
. - public uint attach (MainContext? context = null)
Adds a SignalSource to a
context
so that it will be executed within that context. - protected virtual bool check ()
- public void destroy ()
Removes a source from its MainContext, if any, and mark it as destroyed.
- protected abstract bool dispatch (SourceFunc? _callback)
- public bool get_can_recurse ()
Checks whether a source is allowed to be called recursively.
- public unowned MainContext get_context ()
Gets the MainContext with which the source is associated.
- public void get_current_time (out TimeVal timeval)
This function ignores this and is otherwise the same as TimeVal.
- public uint get_id ()
Returns the numeric ID for a particular source.
- public unowned string? get_name ()
Gets a name for the source, used in debugging and profiling.
- public int get_priority ()
Gets the priority of a source.
- public int64 get_ready_time ()
Gets the "ready time" of this, as set by set_ready_time.
- public int64 get_time ()
Gets the time to be used when checking this source.
- public bool is_destroyed ()
Returns whether this has been destroyed.
- public void modify_unix_fd (void* tag, IOCondition new_events)
Updates the event mask to watch for the fd identified by
tag
. - protected virtual bool prepare (out int timeout_)
- public IOCondition query_unix_fd (void* tag)
Queries the events reported for the fd corresponding to
tag
on this during the last poll. - public void remove_child_source (Source child_source)
Detaches
child_source
from this and destroys it. - public void remove_poll (ref PollFD fd)
Removes a file descriptor from the set of file descriptors polled for this source.
- public void remove_unix_fd (void* tag)
Reverses the effect of a previous call to add_unix_fd.
- public void set_callback (owned SourceFunc func)
- public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs)
Sets the callback function storing the data as a refcounted callback "object".
- public void set_can_recurse (bool can_recurse)
Sets whether a source can be called recursively.
- public void set_dispose_function (SourceDisposeFunc dispose)
Set
dispose
as dispose function on this. - public void set_funcs (SourceFuncs funcs)
Sets the source functions (can be used to override default implementations) of an unattached source.
- public void set_name (string? name)
Sets a name for the source, used in debugging and profiling.
- public void set_priority (int priority)
Sets the priority of a source.
- public void set_ready_time (int64 ready_time)
Sets a SignalSource to be dispatched when the given monotonic time is reached (or passed).
- public void set_static_name (string name)
A variant of set_name that does not duplicate the
name
, and can only be used with string literals.