Re: Possible bug with multiple copies of a window in multiple threads.
- From: muppet <scott asofyet org>
- To: Student <study myrealbox com>, Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Possible bug with multiple copies of a window in multiple threads.
- Date: Sat, 10 Jan 2004 13:11:53 -0500
On Saturday, January 10, 2004, at 10:27 AM, Ross McFarland wrote:
On Fri, 2004-01-09 at 06:44, Student wrote:
Can someone enlighten me on what is going wrong.
basically you're running into several issues. some of with are the
app's
fault and others which aren't (from what i can tell) as a rule (at this
point) if you use threads you have to spawn them before ANY Gtk2-Perl
variables have been created. the reasons for this are rather complex
and
the solutions even more so.
another rule of thumb for X11 apps --- access the gui *only* from one
thread. creating a window in one thread and calling gtk_main in
another is a recipe for disaster.
we have a faq entry about this...
http://gtk2-perl.sourceforge.net/faq/#38
as for *why* not to use the gui from more than one thread: X11 is
thread-safe, but not threadable. the client library uses a single
socket connection to the window server; multiple threads and even
forked child processes have a copy of that file descriptor, and can
confuse the client library if they use it. for example, common problem
include shutting down the parent's X connection in the child, and
confusing the state machines in a parent thread by triggering events
from a child thread.
you can indeed succeed at getting multiple threads to work with the
gui, but it makes me shudder to think about the race conditions, and
personally i avoid it at all costs.
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]