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: [PATCH] Provide pthread_atfork in libc_nonshared.a and libc.a.

On Wed, Oct 02, 2013 at 05:36:04PM -0400, Rich Felker wrote:
> On Wed, Oct 02, 2013 at 05:31:13PM -0400, Carlos O'Donell wrote:
> > The standard design pattern for making it optional to link against
> > libpthread is to mark the function weak, test if the function
> > address is non-zero and call the function, otherwise use a fallback.
> This idiom is completely wrong; it does not work with static linking.

No, that idiom is not wrong, is pretty standard practice for many years,
e.g. libgcc, libstdc++ etc. use it heavily and GCC/binutils extensions
have been designed for it (weakref).

Static linking is much less important than dynamic linking, and forcing
libpthread upon everybody that uses some shared library that should be
thread aware but doesn't really require it is just a bad idea.

There is really no cost in making pthread_atfork not require -lpthread,
because __register_atfork is implemented in libc already.


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