Message258163
An Apple Developer Relations engineer tells me it's "reasonable to assume that getaddrinfo() is thread safe" on OS X 10.5 and later. (He mentioned that iOS inherited the OS X 10.5 DNS architecture, so Apple phones, watches, TVs, hairdryers, etc. can all do concurrent DNS too.)
Before OS X 10.5 the DNS system was a mix of new Mac OS X features, mDNSResponder and Open Directory, along with historical lookupd from NeXT and libresolv from an old BSD. In 10.5 the system was cleaned up to depend on OS X's mDNSResponder consistently; in the process getaddrinfo became thread-safe.
He cites as further evidence of its thread safety:
* The "bugs" section of getaddrinfo's man page was removed in 10.5
* 10.5 is the first OS X to be UNIX '03 certified, which includes the requirement that getaddrinfo be thread-safe
* The system itself uses getaddrinfo extensively as if it's thread-safe
* He hasn't seen reports of thread-safety problems with getaddrinfo
He explained how the code works. In the latest version:
http://www.opensource.apple.com/source/Libinfo/Libinfo-476/lookup.subproj/libinfo.c
getaddrinfo calls down to libinfo’s "mdns" module:
http://www.opensource.apple.com/source/Libinfo/Libinfo-476/lookup.subproj/mdns_module.c
"mdns" uses the DNS-SD API declared in dns_sd.h, which he says is "well known to be thread safe." The DNS-SD API is part of the mDNSResponder project:
http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-576.30.4/
The key function is DNSServiceQueryRecord:
http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-576.30.4/mDNSShared/dnssd_clientstub.c
My contact concludes, "As you can see, it does an IPC over to the mDNSResponder process, at which point thread safety is assured." |
|
Date |
User |
Action |
Args |
2016-01-13 19:43:42 | emptysquare | set | recipients:
+ emptysquare, ronaldoussoren, ned.deily |
2016-01-13 19:43:42 | emptysquare | set | messageid: <1452714222.69.0.0686091737364.issue25924@psf.upfronthosting.co.za> |
2016-01-13 19:43:42 | emptysquare | link | issue25924 messages |
2016-01-13 19:43:41 | emptysquare | create | |
|