This allows you to create a cancellable wrapper around an
uninterruptable function. The GTaskThreadFunc just needs to be
careful that it does not modify any externally-visible state after
it has been cancelled. To do that, the thread should call
Task.setReturnOnCancel again to (atomically) set
return-on-cancel FALSE before making externally-visible changes;
if the task gets cancelled before the return-on-cancel flag could
be changed, Task.setReturnOnCancel will indicate this by
returning FALSE.
You can disable and re-enable this flag multiple times if you wish.
If the task's gio.Cancellable is cancelled while return-on-cancel is
FALSE, then calling Task.setReturnOnCancel to set it TRUE
again will cause the task to be cancelled at that point.
Sets or clears task's return-on-cancel flag. This is only meaningful for tasks run via Task.runInThread or Task.runInThreadSync.
If return_on_cancel is TRUE, then cancelling task's gio.Cancellable will immediately cause it to return, as though the task's GTaskThreadFunc had called Task.returnErrorIfCancelled and then returned.
This allows you to create a cancellable wrapper around an uninterruptable function. The GTaskThreadFunc just needs to be careful that it does not modify any externally-visible state after it has been cancelled. To do that, the thread should call Task.setReturnOnCancel again to (atomically) set return-on-cancel FALSE before making externally-visible changes; if the task gets cancelled before the return-on-cancel flag could be changed, Task.setReturnOnCancel will indicate this by returning FALSE.
You can disable and re-enable this flag multiple times if you wish. If the task's gio.Cancellable is cancelled while return-on-cancel is FALSE, then calling Task.setReturnOnCancel to set it TRUE again will cause the task to be cancelled at that point.
If the task's gio.Cancellable is already cancelled before you call Task.runInThread/Task.runInThreadSync, then the GTaskThreadFunc will still be run (for consistency), but the task will also be completed right away.