Creates a Task acting on source_object
, which will eventually be used to invoke
callback
in the current thread-default main context.
Call this in the "start" method of your asynchronous method, and pass the Task around throughout the asynchronous operation. You can use set_task_data to attach task-specific data to the object, which you can retrieve later via get_task_data .
By default, if cancellable
is cancelled, then the return value of the task will always be
g_io_error_cancelled, even if the task had already completed before the cancellation. This allows for simplified handling in
cases where cancellation may imply that other objects that the task depends on have been destroyed. If you do not want this behavior, you
can use set_check_cancellable to change it.
source_object |
the Object that owns this task, or null. |
cancellable |
optional Cancellable object, null to ignore. |
callback | |
callback_data |
user data passed to |
a Task. |