This is the mail archive of the libc-help@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: Understanding why getaddrinfo_a and __gai_enqueue_request use recursive locks


On 09/23/2017 01:08 AM, Will Hawkins wrote:
> I am sure that there is a very subtle explanation for what is going on
> here, but my mind is too simple to get it. I know that the code works,
> but I am curious about why.
> 
> If you can shed any light on the situation, I'd really appreciate it!

It is a design principle. Acquire the lock if you inspect data that could
be concurrently modified.

You are correct that it looks like the list lock acquisition could be
removed from __gai_enqueue_request. That would be an optimization.
The comments even say so themselves.

Patches welcome! :-)

Please don't be too scared about the contribution checklist, we can
help with any step along the way:

https://sourceware.org/glibc/wiki/Contribution%20checklist

-- 
Cheers,
Carlos.


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