[talk] Is getaddrinfo thread-safe on OS X?
steve.b at osfda.org
Mon Jan 4 09:00:56 EST 2016
Sometimes they do things like that for backlevel compatibility; so
single threaded apps that rely on that global don't immediately break.
The question is: does ds_getaddrinfo _rely_ on that variable?
I doubt it; but it's _possible_ you found an oversight!
On 1/3/2016 10:57 AM, A. Jesse Jiryu Davis wrote:
> 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 thread-safe:
> 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
> <mailto: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>*
> talk mailing list
> talk at lists.nycbug.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk