Source

class Source(pointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance

The GSource struct is an opaque data type representing an event source.

Skipped during bindings generation

  • parameter dispose: SourceDisposeFunc

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val glibSourcePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>?

Functions

Link copied to clipboard
fun addChildSource(childSource: Source)

Adds @child_source to @source as a "polled" source; when @source is added to a struct@GLib.MainContext, @child_source will be automatically added with the same priority, when @child_source is triggered, it will cause @source to dispatch (in addition to calling its own callback), and when @source is destroyed, it will destroy

Link copied to clipboard
fun addPoll(fd: PollFd)

Adds a file descriptor to the set of file descriptors polled for this source. This is usually combined with ctor@GLib.Source.new to add an event source. The event source's check function will typically test the @revents field in the #GPollFD struct and return true if events need to be processed.

Link copied to clipboard
fun addUnixFd(fd: <Error class: unknown class>, events: IoCondition): <Error class: unknown class>

Monitors @fd for the IO events in @events.

Link copied to clipboard
fun attach(context: MainContext? = null): <Error class: unknown class>

Adds a struct@GLib.Source to a @context so that it will be executed within that context. Remove it by calling method@GLib.Source.destroy.

Link copied to clipboard
fun destroy()

Removes a source from its struct@GLib.MainContext, if any, and mark it as destroyed. The source cannot be subsequently added to another context. It is safe to call this on sources which have already been removed from their context.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard

Checks whether a source is allowed to be called recursively. see method@GLib.Source.set_can_recurse.

Link copied to clipboard

Gets the struct@GLib.MainContext with which the source is associated.

Link copied to clipboard
fun getCurrentTime(timeval: TimeVal)

This function ignores @source and is otherwise the same as func@GLib.get_current_time.

Link copied to clipboard
fun getId(): <Error class: unknown class>

Returns the numeric ID for a particular source. The ID of a source is a positive integer which is unique within a particular main loop context. The reverse mapping from ID to source is done by method@GLib.MainContext.find_source_by_id.

Link copied to clipboard
fun getName(): String?

Gets a name for the source, used in debugging and profiling. The name may be #NULL if it has never been set with method@GLib.Source.set_name.

Link copied to clipboard
fun getPriority(): <Error class: unknown class>

Gets the priority of a source.

Link copied to clipboard
fun getReadyTime(): <Error class: unknown class>

Gets the "ready time" of @source, as set by method@GLib.Source.set_ready_time.

Link copied to clipboard
fun getTime(): <Error class: unknown class>

Gets the time to be used when checking this source. The advantage of calling this function over calling func@GLib.get_monotonic_time directly is that when checking multiple sources, GLib can cache a single value instead of having to repeatedly get the system monotonic time.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Returns whether @source has been destroyed.

Link copied to clipboard
fun modifyUnixFd(tag: <Error class: unknown class>, newEvents: IoCondition)

Updates the event mask to watch for the fd identified by @tag.

Link copied to clipboard
fun queryUnixFd(tag: <Error class: unknown class>): IoCondition

Queries the events reported for the fd corresponding to @tag on

Link copied to clipboard
fun ref(): Source

Increases the reference count on a source by one.

Link copied to clipboard
fun removeChildSource(childSource: Source)

Detaches @child_source from @source and destroys it.

Link copied to clipboard

Removes a file descriptor from the set of file descriptors polled for this source.

Link copied to clipboard
fun removeUnixFd(tag: <Error class: unknown class>)

Reverses the effect of a previous call to method@GLib.Source.add_unix_fd.

Link copied to clipboard

Sets the callback function for a source. The callback for a source is called from the source's dispatch function.

Link copied to clipboard
fun setCallbackIndirect(callbackData: <Error class: unknown class>? = null, callbackFuncs: SourceCallbackFuncs)

Sets the callback function storing the data as a refcounted callback "object". This is used internally. Note that calling method@GLib.Source.set_callback_indirect assumes an initial reference count on @callback_data, and thus

Link copied to clipboard
fun setCanRecurse(canRecurse: Boolean)

Sets whether a source can be called recursively. If @can_recurse is true, then while the source is being dispatched then this source will be processed normally. Otherwise, all processing of this source is blocked until the dispatch function returns.

Link copied to clipboard
fun setFuncs(funcs: SourceFuncs)

Sets the source functions (can be used to override default implementations) of an unattached source.

Link copied to clipboard
fun setName(name: String)

Sets a name for the source, used in debugging and profiling. The name defaults to #NULL.

Link copied to clipboard
fun setPriority(priority: <Error class: unknown class>)

Sets the priority of a source. While the main loop is being run, a source will be dispatched if it is ready to be dispatched and no sources at a higher (numerically smaller) priority are ready to be dispatched.

Link copied to clipboard
fun setReadyTime(readyTime: <Error class: unknown class>)

Sets a #GSource to be dispatched when the given monotonic time is reached (or passed). If the monotonic time is in the past (as it always will be if @ready_time is 0) then the source will be dispatched immediately.

Link copied to clipboard

A variant of method@GLib.Source.set_name that does not duplicate the @name, and can only be used with string literals.

Link copied to clipboard
fun unref()

Decreases the reference count of a source by one. If the resulting reference count is zero the source and associated memory will be destroyed.