[Spice-devel] [PATCH] gtask-helper: include functions to check coroutine context

Victor Toso lists at victortoso.com
Sat May 14 20:05:06 UTC 2016


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 at redhat.com> 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 at lists.freedesktop.org
> > 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.
  toso

> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list