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 _gType() @property
Cancellable self()Returns `this`, for use in `with` statements.
CancellableGidBuilder builder()Get builder for [gio.cancellable.Cancellable] Returns: New builder object
gio.cancellable.Cancellable getCurrent()Gets the top cancellable from the stack. Returns: a #GCancellable from the top of the stack, or null if the stack is empty.
void cancel()Will 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)Disconnects 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()Gets 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()Checks 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)Creates 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()Pops cancellable off the cancellable stack (verifying that cancellable is on the top of the stack).
void pushCurrent()Pushes cancellable onto the cancellable stack. The current cancellable can then be received using [gio.cancellable.Cancellable.getCurrent].
void releaseFd()Releases a resources previously allocated by [gio.cancellable.Cancellable.getFd] or [gio.cancellable.Cancellable.makePollfd].
void reset()Resets 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()Creates 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)Connect to `Cancelled` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new #GCancellable object.

Fluent builder for [gio.cancellable.Cancellable]