gio.SimpleAsyncResult — Simple asynchronous results implementation.
for simple cases. Most of the time, this will be all an application needs, and will be used transparently
Because of this, GSimpleAsyncResult is used throughout GIO for handling asynchronous functions.
handles GAsyncReadyCallbacks, error reporting, operation cancellation and the final state of an
operation, completely transparent to the application. Results can be returned as a pointer e.g.
for functions that return data that is collected asynchronously, a boolean value for checking the
success or failure of an operation, or a gssize for operations which return the number of bytes modified
by the operation; all of the simple return cases are covered.
Most of the time, an application will not need to know of the details of this API; it is handled transparently, and any necessary operations are handled by GAsyncResult's interface. However, if implementing a new GIO module, for writing language bindings, or for complex applications that need better control of how asynchronous operations are completed, it is important to understand this functionality.
are tagged with the calling function to ensure that asynchronous functions and
their finishing functions are used together correctly.
An asynchronous operation can be made to ignore a cancellation event by calling
for the operation and
False. This is useful for operations that are dangerous to cancel,
such as close (which would cause a leak if cancelled before being run).
can integrate into GLib's event loop, GMainLoop, or it can use GThreads if available.
will finish an I/O task directly within the main event loop.
will integrate the I/O task into the main event loop as an idle function.
To set the results of an asynchronous function,
are provided, setting the operation's result to a gboolean, or gssize, respectively.
Likewise, to get the result of an asynchronous function,
are provided, getting the operation's result as a gboolean and gssize, respectively.
complete() method completes an asynchronous I/O job.
Must be called in the main thread, as it invokes the callback that should be called
in the main thread. If you are in a different thread use
complete_in_idle() method completes an asynchronous
function in the main event loop using an idle function.
get_op_res_gboolean() method gets the operation
result boolean from within the asynchronous result.
|a gssize returned from the asynchronous function.|
get_op_res_gssize() method gets a gssize
from the asynchronous result.
propagate_error() method propagates an error
from within the simple asynchronous result to a given destination.
set_handle_cancellation() method sets whether
to handle cancellation within the asynchronous operation.
set_op_res_gboolean() method sets the operation
result to a boolean within the asynchronous result.