GTask API Changes

I've made some API changes to the GTask delegates that should make using GTask much less painful. I must have been smoking some seriously good 'ish when I thought it was a good idea to return GValue* from any sort of delegate. That would have required negotiating allocation methods when an allocation shouldn't be necessary to begin with.

typedef GTask* (*GTaskCallback) (GTask    *task,
                                 GValue   *result,
                                 gpointer  user_data);

As you can see, the ability to yield a new task before the callback/errback phase still exists. You simply have a new location to store the result. If there is already a result, you will need to unset that first (unless the types are the same, in which, you can just set the new value).

typedef GTask* (*GTaskCallback) (GTask    *task,
                                 GValue   *result,
                                 gpointer  user_data);

Callbacks are the same signature for now, but I'm curious if people like that or if I should add a second GValue* parameter for the "new result" (and make the first const).

Errbacks also received the new parameter.

typedef GTask* (*GTaskErrback) (GTask        *task,
                                const GError *error,
                                GValue       *result,
                                gpointer      user_data);

Test cases, examples, and bindings were updated to reflect the changes should you wish to see a practical example.

Also, a few race conditions were fixed.

I hope to make a 0.2 release this weekend at SCALE. I'll be building packages shortly and pushing to my PPA.

-- Christian Hergert 2009-02-19

Back to Index