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 10/18/2013 02:14 PM, Jakub Jelinek wrote:
On Fri, Oct 18, 2013 at 02:07:30PM +0200, Florian Weimer wrote:
On 10/02/2013 11:31 PM, Carlos O'Donell wrote:


I think this change makes a lot of sense because we have several
libraries which should use pthread_atfork, but currently don't
because it's difficult to properly obtain access to that symbol.

Could we do something similar for pthread_once?

I don't think that is desirable, pthread_once is significantly different,
if you don't want to link against libpthread for it, just use weak/weakref
check whether it is available and if not, call the function just guarded by
some bit/byte in the pthread_once_t, that is no different from other
routines that can be stubbed for the case when no threads are needed.

Hmm. I'd really like to make it easy for library authors to use this functionality, to encourage them to get rid of explicit global initialization functions. I don't want them to have to reimplement pthread_once just to be able to use it without dragging in the system threading library.

On the other hand, it's not too difficult to implement something like pthread_once on top of the stubbed mutex functions (possibly aided with automics for better performance).

Florian Weimer / Red Hat Product Security Team

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