Help: threading problem in non-threaded applications

Joe Marcus Clarke marcus at FreeBSD.org
Tue Apr 20 13:44:54 PDT 2004


I have a problem I'm hoping someone can help me with.  GTK+ 2.4
introduced a new file selection GUI which works just fine in threaded
and non-threaded applications.  However, GNOME 2.6 augmented this dialog
with a dynamically loadable threaded shared object.  The GNOME version
is automatically used by all GTK+ apps when run under a GNOME desktop if
libgnomeui is installed.

When this object is dynamically loaded into GNOME applications, they
work just fine as they are linked to a thread library.  However, when a
GTK+ non-threaded app tries to load this object, I get a segmentation
fault because the pthread_cond_wait() symbol gets found in libc before
the thread library, and threaded locking isn't setup.  I've tried a lot
of things to try and fix this.  I tried using dlopen/dlsym to resolve
pthread_cond_wait from the thread library, but this doesn't work.  I
tried setting __isthreaded to 1, but that didn't work (it gets
overridden).  The only thing that works is to set LD_PRELOAD to the
thread library before running the non-threaded app (or fixing the app to
link against PTHREAD_LIBS).

Is there a better solution to this?  This problem only seems to affect
5.X.  I'm hoping not to have to link every GTK+ app that might use the
new file selector to PTHREAD_LIBS.  Any advice would be greatly
appreciated.  Thanks.

Joe

-- 
Joe Marcus Clarke
FreeBSD GNOME Team	::	marcus at FreeBSD.org
gnome at FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040420/1aca7db5/attachment.bin


More information about the freebsd-hackers mailing list