Re: Fwd: Re: gnome_show_url() hangs in threaded programs [pawsa theochem kth se]



On 2001.08.24 17:23 Toralf Lund wrote:
> On 2001.08.23 23:38 Pawel Salek wrote:
> > I have forgotten to mention: I have gthread library from
> > glib-1.2.10-ximian, kernel-2.4.3-12, and pthread from glib-2.2.2-10 (if
> > that matters).
> > 
> > /Pawel
> > 
> > On 2001.08.22 21:52 Pawel Salek wrote:
> > > I have impression that something has got broken in gnome_show_url()
> and
> > > related functions (or perhaps, a bug has surfaced that has not been
> > > active earlier).
> > 
> > After closer investigation, I think the problem is in gthread library.
> I
> > attach a test program with does some threading and forking at the same
> > time. 
> > The program WorksForMe(TM) when compiled as follows:
> > # cc atfork-test.c -lthread
> > 
> > The program hangs when compiled as follows:
> > # cc atfork-test.c -lgthread -lglib
> > 
> > I think it should not happen so (and gnome programs hang because they
> > link
> > against gthread). Can someone confirm it? Offer a solution?
> Like I said, I'm seeing the same behaviour.
> 
> However, it turns out that the program works if I do
> % cc atfork-test.c -lgthread -lglib -lpthread -o atfork-test
But note the following:

% cc atfork-test.c -lgthread -lglib -lpthread -o atfork-test
% ldd atfork-test
	libgthread-1.2.so.0 => /usr/lib/libgthread-1.2.so.0 (0x40018000)
	libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x4001b000)
	libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40053000)
	libc.so.6 => /lib/i686/libc.so.6 (0x40068000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
% ./atfork-test
  [everything OK]

% cc atfork-test.c -lgthread -lglib -o atfork-test
% ldd atfork-test
	libgthread-1.2.so.0 => /usr/lib/libgthread-1.2.so.0 (0x40018000)
	libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x4001b000)
	libc.so.6 => /lib/i686/libc.so.6 (0x40053000)
	libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40183000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
% ./atfork-test 

What's that you're saying, you can't tell any difference? -OK, it took me
quite long to spot it, too: libc and libpthread are swapped!

After I discovered this, I did

% cc atfork-test.c -lpthread -lc -o atfork-test

then

% cc atfork-test.c -lc -lpthread -o atfork-test


and just as I suspected: The first version works OK, but the 2nd hangs!

--
- Toralf





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