package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Simple_async_result/index.html

Module Wrappers.Simple_async_result

type t = [ `simple_async_result | `object_ ] Gobject.obj
val set_op_res_gssize : t -> int -> unit

Sets the operation result within the asynchronous result to the given @op_res.

val set_op_res_gboolean : t -> bool -> unit

Sets the operation result to a boolean within the asynchronous result.

val set_handle_cancellation : t -> bool -> unit

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().

val set_from_error : t -> GError.t -> unit

Sets the result from a #GError.

val set_check_cancellable : t -> [ `cancellable | `object_ ] Gobject.obj option -> unit

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.

val propagate_error : t -> (bool, GError.t) result

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.

val get_op_res_gssize : t -> int

Gets a gssize from the asynchronous result.

val get_op_res_gboolean : t -> bool

Gets the operation result boolean from within the asynchronous result.

val complete_in_idle : t -> unit

Completes an asynchronous function in an idle handler in the thread-default main contextg-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.

val complete : t -> unit

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.