Synopsis#include <gio/gio.h> GCancellable; GCancellable* g_cancellable_new (void); gboolean g_cancellable_is_cancelled (GCancellable *cancellable); gboolean g_cancellable_set_error_if_cancelled (GCancellable *cancellable, GError **error); int g_cancellable_get_fd (GCancellable *cancellable); void g_cancellable_make_pollfd (GCancellable *cancellable, GPollFD *pollfd); GCancellable* g_cancellable_get_current (void); void g_cancellable_pop_current (GCancellable *cancellable); void g_cancellable_push_current (GCancellable *cancellable); void g_cancellable_reset (GCancellable *cancellable); void g_cancellable_cancel (GCancellable *cancellable); DescriptionGCancellable is a thread-safe operation cancellation stack used throughout GIO to allow for cancellation of synchronous and asynchronous operations.
Detailsg_cancellable_new ()GCancellable* g_cancellable_new (void); Creates a new GCancellable object. Applications that want to start one or more operations that should be cancellable should create a GCancellable and pass it to the operations. One GCancellable can be used in multiple consecutive operations, but not in multiple concurrent operations.
g_cancellable_is_cancelled ()gboolean g_cancellable_is_cancelled (GCancellable *cancellable); Checks if a cancellable job has been cancelled.
g_cancellable_set_error_if_cancelled ()gboolean g_cancellable_set_error_if_cancelled (GCancellable *cancellable, GError **error);
If the
g_cancellable_get_fd ()int g_cancellable_get_fd (GCancellable *cancellable);
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
See also
g_cancellable_make_pollfd ()void g_cancellable_make_pollfd (GCancellable *cancellable, GPollFD *pollfd);
Creates a GPollFD corresponding to
g_cancellable_get_current ()GCancellable* g_cancellable_get_current (void); Gets the top cancellable from the stack.
g_cancellable_pop_current ()void g_cancellable_pop_current (GCancellable *cancellable);
Pops
g_cancellable_push_current ()void g_cancellable_push_current (GCancellable *cancellable);
Pushes This is useful when implementing cancellable operations in code that does not allow you to pass down the cancellable object. This is typically called automatically by e.g. GFile operations, so you rarely have to call this yourself.
g_cancellable_reset ()void g_cancellable_reset (GCancellable *cancellable);
Resets
g_cancellable_cancel ()void g_cancellable_cancel (GCancellable *cancellable);
Will set
This function is thread-safe. In other words, you can safely call
it from a thread other than the one running the operation that was
passed the The convention within gio is that cancelling an asynchronous operation causes it to complete asynchronously. That is, if you cancel the operation from the same thread in which it is running, then the operation's GAsyncReadyCallback will not be invoked until the application returns to the main loop.
Signal DetailsThe
|
|
a GCancellable. |
|
user data set when the signal handler was connected. |