Source
Object Hierarchy:
Description:
[ Compact ]
public abstract class Source
Content:
Static methods:
- public static void set_name_by_id (uint tag, string? name)
Sets the name of a source using its ID.
- 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 (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.
Creation methods:
Methods:
- public void set_funcs (SourceFuncs funcs)
Sets the source functions (can be used to override default
implementations) of an unattached source.
- public uint attach (MainContext? context)
Adds a
SocketSource to a context
so that it will be executed within that context.
- public void destroy ()
Removes a source from its
MainContext, if any, and mark it as destroyed.
- public bool is_destroyed ()
Returns whether this has been
destroyed.
- public void set_priority (int priority)
Sets the priority of a source.
- public int get_priority ()
Gets the priority of a source.
- public void set_can_recurse (bool can_recurse)
Sets whether a source can be called recursively.
- public bool get_can_recurse ()
Checks whether a source is allowed to be called recursively.
- 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 void set_name (string? name)
Sets a name for the source, used in debugging and profiling.
- public weak MainContext get_context ()
Gets the MainContext
with which the source is associated.
- 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* add_unix_fd (int fd, IOCondition events)
Monitors fd
for the IO events in events
.
- public void remove_unix_fd (void* tag)
- public void modify_unix_fd (void* tag, IOCondition new_events)
Updates the event mask to watch for the fd identified by tag
.
- 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 add_poll (ref PollFD fd)
Adds a file descriptor to the set of file descriptors polled for
this source.
- public void remove_poll (ref PollFD fd)
Removes a file descriptor from the set of file descriptors polled
for this source.
- 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, when child_source
is triggered, it will cause this to dispatch (in addition
to calling its own callback), and when this is destroyed, it will destroy child_source
as well.
- public void remove_child_source (Source child_source)
Detaches child_source
from
this and destroys it.
- public int64 get_time ()
Gets the time to be used when checking this source.
- public void get_current_time (out TimeVal timeval)
This function ignores this and is
otherwise the same as TimeVal.
- public void set_ready_time (int64 ready_time)
Sets a
SocketSource to be dispatched when the given monotonic time is reached (or passed).
- public int64 get_ready_time ()
- protected abstract bool prepare (out int timeout_)
- protected abstract bool check ()
- protected abstract bool dispatch (SourceFunc _callback)