Toso, On Sat, May 14, 2016 at 10:05 PM, Victor Toso <lists@xxxxxxxxxxxxxx> wrote: > Hi, > > On Sat, May 14, 2016 at 06:34:41PM +0200, Fabiano Fidêncio wrote: >> On Sat, May 14, 2016 at 5:03 PM, Victor Toso <victortoso@xxxxxxxxxx> wrote: >> > If we are in coroutine context, fallback to return in idle; Otherwise, >> > let GTask decide if callback should be called or not. >> > --- >> > src/gtask-helper.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ >> > 1 file changed, 45 insertions(+) >> > >> > diff --git a/src/gtask-helper.h b/src/gtask-helper.h >> > index 81c041f..8771021 100644 >> > --- a/src/gtask-helper.h >> > +++ b/src/gtask-helper.h >> > @@ -29,6 +29,51 @@ void g_task_helper_return_error_in_idle(GTask *task, GError *error); >> > void g_task_helper_return_new_error_in_idle(GTask *task, GQuark domain, gint code, const char *format, ...); >> > void g_task_helper_return_pointer_in_idle(GTask *task, gpointer result, GDestroyNotify result_destroy); >> > >> > +#define g_task_helper_return_boolean(...) \ >> > + do { \ >> > + if (coroutine_self_is_main()) { \ >> > + g_task_return_boolean(__VA_ARGS__); \ >> > + } else { \ >> > + g_task_helper_return_boolean_in_idle(__VA_ARGS__); \ >> > + } \ >> > + } while (0) >> > + >> > +#define g_task_helper_return_int(...) \ >> > + do { \ >> > + if (coroutine_self_is_main()) { \ >> > + g_task_return_int(__VA_ARGS__); \ >> > + } else { \ >> > + g_task_helper_return_int_in_idle(__VA_ARGS__); \ >> > + } \ >> > + } while (0) >> > + >> > +#define g_task_helper_return_error(...) \ >> > + do { \ >> > + if (coroutine_self_is_main()) { \ >> > + g_task_return_error(__VA_ARGS__); \ >> > + } else { \ >> > + g_task_helper_return_error_in_idle(__VA_ARGS__); \ >> > + } \ >> > + } while (0) >> > + >> > +#define g_task_helper_return_new_error(...) \ >> > + do { \ >> > + if (coroutine_self_is_main()) { \ >> > + g_task_return_new_error(__VA_ARGS__); \ >> > + } else { \ >> > + g_task_helper_return_new_error_in_idle(__VA_ARGS__); \ >> > + } \ >> > + } while (0) >> > + >> > +#define g_task_helper_return_pointer(...) \ >> > + do { \ >> > + if (coroutine_self_is_main()) { \ >> > + g_task_return_pointer(__VA_ARGS__); \ >> > + } else { \ >> > + g_task_helper_return_pointer_in_idle(__VA_ARGS__); \ >> > + } \ >> > + } while (0) >> > + >> > G_END_DECLS >> > >> > #endif /* __G_TASK_HELPER_H__ */ >> > -- >> > 2.5.5 >> > >> > _______________________________________________ >> > Spice-devel mailing list >> > Spice-devel@xxxxxxxxxxxxxxxxxxxxx >> > https://lists.freedesktop.org/mailman/listinfo/spice-devel >> >> NACK! >> This is not what we agreed on IRC yesterday :-\ >> Anyways, with https://lists.freedesktop.org/archives/spice-devel/2016-May/029040.html >> this patch doesn't seem to be needed anymore. > > Yes, this is not needed. No, it isn't what we agreed on IRC, just the > idea that is. I realized while testing that this would not needed but I > thought it would be good to share the patch anyway. I should have > mentioned this in the email. > > Sorry for taking your time and thanks for reviewing. There is nothing to be sorry about! I'd like to have the g_task_helper_* in anyways, but without the smartness (I mean, just returning in idle). I do believe it's cleaner/better than just adding an idle. But it's not up to me. > toso > >> _______________________________________________ >> Spice-devel mailing list >> Spice-devel@xxxxxxxxxxxxxxxxxxxxx >> https://lists.freedesktop.org/mailman/listinfo/spice-devel > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel Best Regards, -- Fabiano Fidêncio _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel