[talk] Is getaddrinfo thread-safe on OS X?
A. Jesse Jiryu Davis
jesse at emptysquare.net
Sun Jan 3 10:57:13 EST 2016
Thanks for the pointers, with your help I'm making progress. I think I
found the source for Apple's getaddrinfo.
In Apple's Libinfo version 222.4.12, the man page says getaddrinfo isn't
And here's its source:
Glancing at the source naïvely, I might see the data race: getaddrinfo
calls gai_lookupd, which reads and writes the global static variable
"gai_proc". I can't see what will go wrong as a result of the race, but it
sure LOOKS bad. =)
In the next release, version 278, the thread-safety warning is gone from
the man page:
And getaddrinfo is largely rewritten:
It calls a new function, "ds_getaddrinfo". But ds_getaddrinfo still
accesses the global static variable "gai_proc"; I wonder why this is
considered thread-safe now?
On Sun, Jan 3, 2016 at 12:14 AM, Siobhan Lynch <slynch2112 at me.com> wrote:
> OK… try and look at the revision histories of these three files:
> *#include* *<sys/types.h>*
> *#include* *<sys/socket.h>*
> *#include* *<netdb.h>*
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk