Class: Gio::SimpleAsyncResult
- Inherits:
-
Object
- Object
- Gio::SimpleAsyncResult
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#check_cancellable=(check_cancellable) ⇒ nil
Sets a #GCancellable to check before dispatching results.
-
#complete ⇒ nil
Completes an asynchronous I/O job immediately.
-
#complete_in_idle ⇒ nil
Completes an asynchronous function in an idle handler in the [thread-default main context] of the thread that simple was initially created in (and re-pushes that context around the invocation of the callback).
-
#from_error=(error) ⇒ nil
Sets the result from a #GError.
-
#handle_cancellation=(handle_cancellation) ⇒ nil
Sets whether to handle cancellation within the asynchronous operation.
-
#new(source_object, callback, user_data, source_tag) ⇒ Gio::SimpleAsyncResult
Creates a GSimple::AsyncResult.
-
#new_error(source_object, callback, user_data, domain, code, format, array) ⇒ Gio::SimpleAsyncResult
Creates a new GSimple::AsyncResult with a set error.
-
#new_from_error(source_object, callback, user_data, error) ⇒ Gio::SimpleAsyncResult
Creates a GSimple::AsyncResult from an error condition.
-
#new_take_error(source_object, callback, user_data, error) ⇒ Gio::SimpleAsyncResult
Creates a GSimple::AsyncResult from an error condition, and takes over the caller’s ownership of error, so the caller does not need to free it anymore.
-
#op_res_gboolean ⇒ TrueClass
Gets the operation result boolean from within the asynchronous result.
-
#op_res_gboolean=(op_res) ⇒ nil
Sets the operation result to a boolean within the asynchronous result.
-
#op_res_gpointer ⇒ GObject
Gets a pointer result as returned by the asynchronous function.
-
#op_res_gssize ⇒ Gio::gssize
Gets a gssize from the asynchronous result.
-
#op_res_gssize=(op_res) ⇒ nil
Sets the operation result within the asynchronous result to the given op_res.
-
#propagate_error ⇒ TrueClass
Propagates an error from within the simple asynchronous result to a given destination.
-
#run_in_thread(func, io_priority, cancellable) ⇒ nil
Runs the asynchronous job in a separate thread and then calls g_simple_async_result_complete_in_idle() on simple to return the result to the appropriate main loop.
-
#set_error(domain, code, format, array) ⇒ nil
Sets an error within the asynchronous result without a #GError.
-
#set_error_va(domain, code, format, args) ⇒ nil
Sets an error within the asynchronous result without a #GError.
-
#set_op_res_gpointer(op_res, destroy_op_res) ⇒ nil
Sets the operation result within the asynchronous result to a pointer.
-
#source_tag ⇒ GObject
Gets the source tag for the GSimple::AsyncResult.
-
#take_error(error) ⇒ nil
Sets the result from error, and takes over the caller’s ownership of error, so the caller does not need to free it any more.
Instance Method Details
#check_cancellable=(check_cancellable) ⇒ nil
Sets a #GCancellable to check before dispatching results.
This function has one very specific purpose: the provided cancellable is checked at the time of g_simple_async_result_propagate_error() If it is cancelled, these functions will return an “Operation was cancelled” error (%G_IO_ERROR_CANCELLED).
Implementors of cancellable asynchronous functions should use this in order to provide a guarantee to their callers that cancelling an async operation will reliably result in an error being returned for that operation (even if a positive result for the operation has already been sent as an idle to the main context to be dispatched).
The checking described above is done regardless of any call to the unrelated g_simple_async_result_set_handle_cancellation() function.
#complete ⇒ nil
Completes an asynchronous I/O job immediately. Must be called in the thread where the asynchronous result was to be delivered, as it invokes the callback directly. If you are in a different thread use g_simple_async_result_complete_in_idle().
Calling this function takes a reference to simple for as long as is needed to complete the call.
#complete_in_idle ⇒ nil
Completes an asynchronous function in an idle handler in the
- thread-default main context][g-main-context-push-thread-default
-
of the thread that simple was initially created in (and re-pushes that context around the invocation of the callback).
Calling this function takes a reference to simple for as long as is needed to complete the call.
#from_error=(error) ⇒ nil
Sets the result from a #GError.
#handle_cancellation=(handle_cancellation) ⇒ nil
Sets whether to handle cancellation within the asynchronous operation.
This function has nothing to do with g_simple_async_result_set_check_cancellable(). It only refers to the #GCancellable passed to g_simple_async_result_run_in_thread().
#new(source_object, callback, user_data, source_tag) ⇒ Gio::SimpleAsyncResult
Creates a GSimple::AsyncResult.
The common convention is to create the GSimple::AsyncResult in the function that starts the asynchronous operation and use that same function as the source_tag.
If your operation supports cancellation with #GCancellable (which it probably should) then you should provide the user’s cancellable to g_simple_async_result_set_check_cancellable() immediately after this function returns.
#new_error(source_object, callback, user_data, domain, code, format, array) ⇒ Gio::SimpleAsyncResult
Creates a new GSimple::AsyncResult with a set error.
#new_from_error(source_object, callback, user_data, error) ⇒ Gio::SimpleAsyncResult
Creates a GSimple::AsyncResult from an error condition.
#new_take_error(source_object, callback, user_data, error) ⇒ Gio::SimpleAsyncResult
Creates a GSimple::AsyncResult from an error condition, and takes over the caller’s ownership of error, so the caller does not need to free it anymore.
#op_res_gboolean ⇒ TrueClass
Gets the operation result boolean from within the asynchronous result.
#op_res_gboolean=(op_res) ⇒ nil
Sets the operation result to a boolean within the asynchronous result.
#op_res_gpointer ⇒ GObject
Gets a pointer result as returned by the asynchronous function.
#op_res_gssize ⇒ Gio::gssize
Gets a gssize from the asynchronous result.
#op_res_gssize=(op_res) ⇒ nil
Sets the operation result within the asynchronous result to the given op_res.
#propagate_error ⇒ TrueClass
Propagates an error from within the simple asynchronous result to a given destination.
If the #GCancellable given to a prior call to g_simple_async_result_set_check_cancellable() is cancelled then this function will return true with dest set appropriately.
#run_in_thread(func, io_priority, cancellable) ⇒ nil
Runs the asynchronous job in a separate thread and then calls g_simple_async_result_complete_in_idle() on simple to return the result to the appropriate main loop.
Calling this function takes a reference to simple for as long as is needed to run the job and report its completion.
#set_error(domain, code, format, array) ⇒ nil
Sets an error within the asynchronous result without a #GError.
#set_error_va(domain, code, format, args) ⇒ nil
Sets an error within the asynchronous result without a #GError. Unless writing a binding, see g_simple_async_result_set_error().
#set_op_res_gpointer(op_res, destroy_op_res) ⇒ nil
Sets the operation result within the asynchronous result to a pointer.
#source_tag ⇒ GObject
Gets the source tag for the GSimple::AsyncResult.
#take_error(error) ⇒ nil
Sets the result from error, and takes over the caller’s ownership of error, so the caller does not need to free it any more.