GSimpleAsyncResult: support reliable cancellation

Add a function g_simple_async_result_set_check_cancellable() to provide
a GCancellable that is checked for being cancelled during the call to
g_simple_async_result_propagate_error().

This gives asynchronous operation implementations an easy way to
provide reliable cancellation of those operations -- even in the case
that a positive result has occured and is pending dispatch at the time
the operation is cancelled.

https://bugzilla.gnome.org/show_bug.cgi?id=672013
This commit is contained in:
Ryan Lortie
2012-03-13 16:09:01 -04:00
parent 53b1afba0e
commit 4804094472
4 changed files with 62 additions and 0 deletions

View File

@@ -83,6 +83,8 @@ gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResul
void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
GCancellable *check_cancellable);
gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
gboolean handle_cancellation);