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 353533 - Make ekiga less thready
Make ekiga less thready
Status: RESOLVED FIXED
Product: ekiga
Classification: Applications
Component: general
GIT master
Other All
: Low enhancement
: ---
Assigned To: Snark
Ekiga maintainers
Depends on:
Blocks:
 
 
Reported: 2006-08-30 11:45 UTC by Snark
Modified: 2008-04-03 10:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Snark 2006-08-30 11:45:27 UTC
This is from a mail I recently sent to the devel-list, where I present an idea Damien thinks interesting but not urgent ; committing to bugzilla to keep in sight :

threads in ekiga are quite problematic :
(1) $ grep -r . -e _threads_ | wc -l
449
(2) bug #329454

We can't really get rid of them, so we have to find a way to live with them.

The work to switch to a signal/callback approach gives an occasion to 
(mostly) solve the issue.

Indeed, we'll need a GObject to wrap the endpoint, which will emit said 
signals, on which the gui will live. Things will look like this at the end :

         GUI
          |
          v
endpoint-as-GObject
          |
          v
endpoint-as-C++-object

With a transition by :

    partial new GUI    partial old GUI
           |                  |
           v                  |
endpoint-as-GObject          |
           |                  |
           v                  |
endpoint-as-C++-object  <-----

Now what I propose is to make the endpoint-as-GObject live and emit 
signals in the glib main loop (ie: in the GUI thread) : this means all 
the gui won't need any gdk_threads_* (or gnomemeeting_threads_*) calls.

There will probably be only two places where dealing with threads will 
still be needed :
(1) on the endpoint-as-GObject -> endpoint-as-C++-object transition (!)
(2) in PVideoOutputDevice_GDK, since the media streams are a place where 
threads can't be avoided for performance reasons.

How does one deal with threads in (1) ? Probably just like gstreamer 
does in GstBus.

The GstBus is an object, which contains a GQueue of messages, protected 
by a GMutex. When something "interesting" happens in a thread, a message 
is added to the queue (which is protected, so it's ok). The bus is 
registered as a GSource to the glib main loop, so the main loop triggers 
the processing of the messages from time to time (and this happens in 
the GUI thread!).
Comment 1 Snark 2006-11-07 11:44:05 UTC
In fact, a GAsyncQueue will perfectly fit here!

Additionally, most of the code is already there in the dbus component code. To make it complete, one would just have to :
(1) make the calls from the endpoint to the GObject go through messages in the queue ;
(2) make the queue checked in a GSource in the glib main loop, so the messages are processed.

It doesn't look insanely difficult.
Comment 2 Snark 2007-04-11 07:36:51 UTC
Whas about putting a copy of GstBus renamed as GmBus in ekiga ?
(of course with proper notice of where the code comes from -- like for e-vard.[ch])
Comment 3 Snark 2007-08-04 13:07:57 UTC
The goal hasn't changed, but we'll get there by a different route.
Comment 4 Damien Sandras 2008-04-02 21:47:18 UTC
We can consider this as FIXED as part of the engine work.

Of course, there are still things to do, but there will always be. Closing.