This is the mail archive of the libc-alpha@sourceware.org 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 Fri, Oct 18, 2013 at 02:07:30PM +0200, Florian Weimer wrote:
> On 10/02/2013 11:31 PM, Carlos O'Donell wrote:
> 
> >Comments?
> 
> 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.
Unlike pthread_atfork, pthread_once isn't implemented in libc.so already,
it would need to be another export that would check for libpthread presence
and call the libpthread implementation in that case, otherwise do the easy
non-thread-safe fallback.

	Jakub


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