Class

GioCancellable

Description [src]

class Gio.Cancellable : GObject.Object
{
  /* No available fields */
}

GCancellable allows operations to be cancelled.

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

Ancestors

Constructors

g_cancellable_new

Creates a new GCancellable object.

Functions

g_cancellable_get_current

Gets the top cancellable from the stack.

Instance methods

g_cancellable_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 connect to it.).

g_cancellable_connect

Convenience function to connect to the GCancellable::cancelled signal. Also handles the race condition that may happen if the cancellable is cancelled right before connecting.

since: 2.22

g_cancellable_disconnect

Disconnects a handler from a cancellable instance similar to g_signal_handler_disconnect(). Additionally, in the event that a signal handler is currently running, this call will block until the handler has finished. Calling this function from a GCancellable::cancelled signal handler will therefore result in a deadlock.

since: 2.22

g_cancellable_get_fd

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.

g_cancellable_is_cancelled

Checks if a cancellable job has been cancelled.

g_cancellable_make_pollfd

Creates a GPollFD corresponding to cancellable; this can be passed to g_poll() and used to poll for cancellation. This is useful both for unix systems without a native poll and for portability to windows.

since: 2.22

g_cancellable_pop_current

Pops cancellable off the cancellable stack (verifying that cancellable is on the top of the stack).

g_cancellable_push_current

Pushes cancellable onto the cancellable stack. The current cancellable can then be received using g_cancellable_get_current().

g_cancellable_release_fd

Releases a resources previously allocated by g_cancellable_get_fd() or g_cancellable_make_pollfd().

since: 2.22

g_cancellable_reset

Resets cancellable to its uncancelled state.

g_cancellable_set_error_if_cancelled

If the cancellable is cancelled, sets the error to notify that the operation was cancelled.

g_cancellable_source_new

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_source_add_child_source() to add cancellability to it.

since: 2.28

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Signals

Gio.Cancellable::cancelled

Emitted when the operation has been cancelled.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GioCancellableClass {
  GObjectClass parent_class;
  void (* cancelled) (
    GCancellable* cancellable
  );
  void (* _g_reserved1) (
void
  );
  void (* _g_reserved2) (
void
  );
  void (* _g_reserved3) (
void
  );
  void (* _g_reserved4) (
void
  );
  void (* _g_reserved5) (
void
  );
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.

cancelled: void (* cancelled) ( GCancellable* cancellable )

No description available.

_g_reserved1: void (* _g_reserved1) ( void )

No description available.

_g_reserved2: void (* _g_reserved2) ( void )

No description available.

_g_reserved3: void (* _g_reserved3) ( void )

No description available.

_g_reserved4: void (* _g_reserved4) ( void )

No description available.

_g_reserved5: void (* _g_reserved5) ( void )

No description available.

Virtual methods

Gio.CancellableClass.cancelled
No description available.