This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Question] threads.h library

On Sat, Feb 28, 2015 at 03:09:19PM +0100, Juan Manuel Torres Palma wrote:
> Hi glibc folks.
> As many of you may remember, I'm trying to add threads.h support for
> glibc. I have done a lot of improvements now that I have some free
> time. However, today was compiling and got a linker error, complaining
> about pthreads function definition and I realized that I need some
> guidance about where to add this library.
> Choices are 2:
> - libc. In this case, I would need to add -lpthread to the linker.
> - libpthread. In this case it's simpler, but I don't know if it's
> correct to put it here.
> I would like to know where to comile this module with, and why.

While I would very much like it, I think you'll find strong opposition
to adding libpthread to's DT_NEEDED.

I think the opposite would be much more agreeable to most people. If
it seems odd that you need a -l option (-lpthread) to access standard
ISO C functionality, consider that this is already the case for math
functions (-lm). Since ISO C does not specify how the compiler is
invoked, there's nothing wrong with telling users "you need -lpthread
to get this functionality".

Adding a third library may seem like an attractive option, but I think
it would be considerably worse. Since most of the C11 thread functions
need to access namespace-safe versions of the pthread functions, you'd
end up adding __-prefixed versions of most of the pthread symbols to
the public/inter-library API for libpthread (so libthrd could use
them) rather than having these be internal hidden symbols in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]