After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677898 - gst_task_set_thread_callback_funcs is not binding-friendly
gst_task_set_thread_callback_funcs is not binding-friendly
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-11 20:59 UTC by Evan Nemerson
Modified: 2012-06-20 10:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
task: add gst_task_set_thread_callback_funcs and GstTaskThreadFunc (9.29 KB, patch)
2012-06-11 20:59 UTC, Evan Nemerson
none Details | Review

Description Evan Nemerson 2012-06-11 20:59:07 UTC
Created attachment 216153 [details] [review]
task: add gst_task_set_thread_callback_funcs and GstTaskThreadFunc

gst_task_set_thread_callback_funcs (and GstTaskThreadFunc) are not very friendly to bindings.

The (currently untested) attached patch creates the following API:


typedef void (*GstTaskThreadFunc) (GstTask *task, GThread *thread, gpointer user_data);

void
gst_task_set_thread_callback_funcs (GstTask * task,
                                    GstTaskThreadFunc enter_thread,
                                    gpointer enter_thread_data,
                                    GDestroyNotify enter_thread_notify,
                                    GstTaskThreadFunc leave_thread,
                                    gpointer leave_thread_data,
                                    GDestroyNotify leave_thread_notify);


It also adds g-i annotations to skip the old API.
Comment 1 Wim Taymans 2012-06-20 09:27:34 UTC
I don't like this, the point of the structure with callbacks was to be able to add more callbacks later when needed. Now with the method we need to add a new method and deprecate the old one.

Maybe we should get rid of the structure of callbacks and just do

gst_task_set_thread_enter_callback (GstTask *task, 
                                    GstTaskThreadFunc enter_thread,
                                    gpointer user_data,
                                    GDestroyNotify notify);
gst_task_set_thread_leave_callback (GstTask *task, 
                                    GstTaskThreadFunc leave_thread,
                                    gpointer user_data,
                                    GDestroyNotify notify);
Comment 2 Evan Nemerson 2012-06-20 09:44:08 UTC
That sounds good to me.

Do you really ever see adding new callbacks?  If not, gst_task_set_thread_callbacks could be re-purposed as a convenience method for C programmers who want to use the same user data and destroy notify for both:

gst_task_set_thread_callbacks (GstTask *task,
                               GstTaskThreadFunc enter_thread,
                               GstTaskThreadFunc leave_thread,
                               gpointer user_data,
                               GDestroyNotify notify);

Of course, even if you don't want to add a callback, there could be gst_task_set_thread_callbacks_full, or gst_task_set_thread_callbacks_with_foo, etc.
Comment 3 Wim Taymans 2012-06-20 10:01:14 UTC
OK!

commit b2aa56f4e3965d2a7e0bf1beaf8916631392b52f
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Wed Jun 20 11:59:09 2012 +0200

    task: add separate methods to add enter/leave callback
    
    Remove the structure of callbacks and replace with separate methods to register
    each callback. This is much more binding friendly.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=677898