gio.cancellable

Module for [Cancellable] class

Types 3

gio.cancellable.Cancellable allows operations to be cancelled.

gio.cancellable.Cancellable is a thread-safe operation cancellation stack used throughout GIO to allow for cancellation of synchronous and asynchronous operations.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
Cancellable self() nothrowReturns `this`, for use in `with` statements.
CancellableGidBuilder builder() static nothrowGet builder for [gio.cancellable.Cancellable] Returns: New builder object
gio.cancellable.Cancellable getCurrent() static nothrowGets the top cancellable from the stack. Returns: a #GCancellable from the top of the stack, or null if the stack is empty.
void cancel() nothrowWill set cancellable to cancelled, and will emit the #GCancellable::cancelled signal. (However, see the warning about race conditions in the documentation for that signal if you are planning to con...
void disconnect(gulong handlerId) nothrowDisconnects a handler from a cancellable instance similar to [gobject.global.signalHandlerDisconnect]. Additionally, in the event that a signal handler is currently running, this call will block u...
int getFd() nothrowGets the file descriptor for a cancellable job. This can be used to implement cancellable operations on Unix systems. The returned fd will turn readable when cancellable is cancelled.
bool isCancelled() nothrowChecks if a cancellable job has been cancelled. Returns: true if cancellable is cancelled, FALSE if called with null or if item is not cancelled.
bool makePollfd(glib.types.PollFD pollfd) nothrowCreates a #GPollFD corresponding to cancellable; this can be passed to [glib.global.poll] and used to poll for cancellation. This is useful both for unix systems without a native poll and for porta...
void popCurrent() nothrowPops cancellable off the cancellable stack (verifying that cancellable is on the top of the stack).
void pushCurrent() nothrowPushes cancellable onto the cancellable stack. The current cancellable can then be received using [gio.cancellable.Cancellable.getCurrent].
void releaseFd() nothrowReleases a resources previously allocated by [gio.cancellable.Cancellable.getFd] or [gio.cancellable.Cancellable.makePollfd].
void reset() nothrowResets cancellable to its uncancelled state.
bool setErrorIfCancelled()If the cancellable is cancelled, sets the error to notify that the operation was cancelled. Returns: true if cancellable was cancelled, false if it was not Throws: [ErrorWrap]
glib.source.Source sourceNew() nothrowCreates a source that triggers if cancellable is cancelled and calls its callback of type #GCancellableSourceFunc. This is primarily useful for attaching to another (non-cancellable) source with [g...
gulong connectCancelled(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.cancellable.Cancellable))) && Parameters!T.length < 2) nothrowConnect to `Cancelled` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new #GCancellable object.

Fluent builder for gio.cancellable.Cancellable

Methods
Cancellable build() nothrowCreate object from builder. Returns: New object