tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Moving pthread_(cond|mutex) to libc

On Sat, Jan 26, 2013 at 09:01:32PM +0100, Joerg Sonnenberger wrote:
 > On Fri, Jan 25, 2013 at 05:21:51PM +0000, David Holland wrote:
 > > That said, it's a fair point. If I'm writing a library, and I want the
 > > library to be safely usable by both threaded and unthreaded programs,
 > > is there anything I can do? Right now it seems the only fully viable
 > > approach is to build two versions and hope I can figure out how to get
 > > clients to link the right one, which is pretty sketchy.
 > You can use mutexes and cvs and a number of other things just fine.
 > The only thing you are not allowed to do is call pthread_create.

So if I have such a library, should I compile and link it with or
without using -pthread? If I do, AFAIK it will be linked against and then fail to dlopen; if I don't, I'm not sure what
the precise consequences are but I dimly recall that other things will
go wrong.

 > That is the problem with GLib2, where the calls to pthread_create
 > are in the main library, not even in libgthread.

Nice software doesn't use glib2. :-/

David A. Holland

Home | Main Index | Thread Index | Old Index