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: Dummy pthread functions in libc considered harmful


On Tue, Aug 25, 2015 at 04:01:20PM +0300, Alexander Monakov wrote:
> On Tue, 25 Aug 2015, OndÅej BÃlka wrote:
> > As we internally already have SINGLE_THREAD_P optimization we should use 
> > that optimization for all atomics and locks and get slower path only
> > when there is some thread created.
> > 
> > We could export that variable for gcc to also speed up atomics.
> 
> It's not possible to use "current process is single-threaded" predicate to
> optimize atomics: they might be operating on shared memory.
> 
> (however when libpthread is not linked in, you know that pthread_mutex_lock is
> not operating on shared memory: you'd need pthread_mutexattr_setpshared, which
> is not provided in libc.so.6)
> 
You can. Shared memory doesn't matter as you will set that up when
program is single-threaded. That is unless user creates thread in signal
handler which is illegal.


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