Re: Threaded Gtk2->main causing seg fault



Kevin Leung said:
Hi

I understand that this is not normal usage of perl gtk+, but I really
have no options because I am writing a plugin which must provide a GUI.
If I just run the Gtk2->main without a new thread, the plugin will block.

the basic statement at this point is that having perl Gtk/Glib objects in two
threads is not supported. if you haven't already seen it
examples/thread_usage.pl shows you what you can do without any problem. that
being said most of the issues you will see will be as the program is exiting
and things are cleaning up.

as of right now this issue is on the todo list for 1.06x, but in the end there
may not be a workable solution. the main problem is the only hook with which
we have to work is CLONE. and the problem with CLONE is that it's called on a
per package basis rather than per object. that's going to require us to do one
of two things: keep a list of all objects around so that when we enter the pkg
CLONE we can go through that list doing whatever ends up being necessary.

the other alternative (and this one is pretty wild and probably not that good.
it hasn't even been tested or tried, i just now came up with it) would be to
create a new package for each object setting it's ISA appropriately. we might
get a per object CLONE call this way. the packages would be something odd and
unique __GOBJECT_PKG_XXXXXXXXX_ or something.

basically if you can't make due with things like thread_usage.pl or use
fork/plug/socket then you'll have to wait for or fix the issues. i'll look
into it some more again now, but i'm not promissing anything. there may be
some fundamental problems lurking around.

perl threads have lots of issues which is why many distros don't consider them
stable enough to put in their perl builds.

-rm




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