GTask callbacks not introspection-friendly
Submitted by Evan Nemerson
Link to original bug (#693576)
Description
I'm updating Vala's GIO bindings, and I've noticed that g_task_run_in_thread and g_task_run_in_thread_sync aren't very useful for GObject Introspection consumers because the task data handled separately from the callback.
I see two relatively simple options. The first is to add introspection-friendly versions (g_task_run_in_thread_with_data and g_task_run_in_thread_with_data_sync, perhaps) which would look something like this:
void g_task_run_in_thread_with_data (GTask *task, GTaskThreadFunc task_func, gpointer task_data, GDestroyNotify task_data_destroy) { g_task_set_task_data (task, task_data, task_data_destroy); g_task_run_in_thread (task, task_func); g_task_set_task_data (task, NULL); };
(I know this would clobber existing task_data, but that wouldn't be hard to fix and you get the idea.)
With some relatively straightforward annotations we could skip all the currently existing functions which deal with task_data and rename the *_with_data.
The other option would be to just make GTask always work like this. I'm not sure how useful setting the task_data separately is (I haven't played with the API)... if it's not very useful I think this would be a good option, since it feels more like most other gnome-ish APIs.