RE: multi-threaded apps.



Ian,

GTK+ support for threads may have improved recently, but according to the
FAQ I just browsed I think you'll run into the same difficulty that I did
when I was initally writing the threaded code, and that is the following:
writing the threads so that you can call GTK+ functions from /within/ a
thread involves extensive revision of the GTK+ code in the /main/ thread.
(In all code except for callbacks handling signals, gtk calls have to grab
the lock gdk_thread_enter and release it, gdk_thread_leave.)

This is why I have the system setup with pipes -- the only reason, really,
to have the pipes is to allow the child thread to tell the parent thread to
do something involving GTK+.  If the intent is to cleanup the code, it may
(or may not) make sense to do this work, but probably only if you really are
going to make balsa run exclusively with threads.  (Imagine the #ifdefs.)

Of course, my info may be out of date.

Good luck.  BTW, I know I've basically disappeared, but if you need to
rework the threaded code in some way I may be able to help out.  I just
don't have time to take on any new 'functionality' for balsa.  (The sending
code is (was?) a bit of a mess, but that's another, longer, story involving
the integration of the two methods for sending messages and doesn't really
have to do, directly, with the initial design for the sending thread --
which I think was pretty clean.)

David


> -----Original Message-----
> From: gnome-devel-list-admin@gnome.org
> [mailto:gnome-devel-list-admin@gnome.org]On Behalf Of Ian Campbell
> Sent: Thursday, August 17, 2000 2:50 PM
> To: gnome-devel-list@gnome.org
> Subject: multi-threaded apps.
>
>
>
>
> I am busy checking that Balsa correctly grabs the GDK lock when
> running with
> threads enabled.
>
> The FAQ says that Glib callbacks (I/O, idle and timeouts) are
> called without
> the lock, but that GTK+ callbacks will be called with the lock held.
>
> I cannot find the point where the lock is grabbed when emitting the GTK+
> signal.
>
> So my question is: If I emit a signal in a thread, do I need to
> grab the lock
> before emmiting the signal?
>
> Cheers,
> Ian.
>
> --
> Ian Campbell
> Churchill College, Cambridge.
>
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]