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 Sun, Jan 27, 2013 at 07:23:49AM +0000, David Holland wrote:
> 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.

Without -pthread.


Home | Main Index | Thread Index | Old Index