Subject: Re: Threading problems
To: Daniel Carosone <dan@geek.com.au>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-pkg
Date: 03/23/2005 10:34:34
This problem arose with guile, too.  guile can dlopen random shlibs
under control of user Scheme code.  guile used to not be linked
threaded, but then when gtk got linked in (see devel/guile-gtk) it
would make libc calls that would assert.

I can see several possible approaches:

 as you hint, add a rule that every program in pkgsrc that can
 possibly dlopen anything be linked with pthreads.

 give up on the notion of non-threaded programs, leaving instead
 programs that have not created more threads.   Use the mutexes all
 the time.

 adjust libc etc. so that a program can transition from non-threaded
 to threaded, and change the isthreaded variable, so that mutexes will
 start being used.  If this happens in the first thread during
 pthread_create it should be possible to mak it safe from a
 synchronization viewpoint.  I know I don't understand the weak
 symbols/libpthread shadows libc issues, so maybe this can't work.


-- 
        Greg Troxel <gdt@ir.bbn.com>