This is the mail archive of the libc-alpha@sources.redhat.com 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: Is gethostbyname_r() reentrant?


> Checking the code, it seemed that the only difference between
> gethostbyname_r() function and gethostbyname() was where the result
> was placed.  Each thread would use the same socket when communicating
> with the DNS server, and it would be hard do know wich thread would
> recieve the DNS replies.

All the state such as the file descriptors for sockets live in the _res
data structure.  That is per-thread via macro magic or TLS, not a global
variable as it might appear to be (and was originally in the days before
threading support).


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