4 ms·
while there is an overlap between libc and POSIX where by POSIX defines its standard in terms of the C language spec and its std lib, getaddrinfo(3) behavior is
by halayli 6y ago
while there is an overlap between libc and POSIX where by POSIX defines its standard in terms of the C language spec and its std lib, getaddrinfo(3) behavior is part of POSIX standard only.
Obviously go devs are attempting to do the right thing here and trying to implement async version of getaddrinfo(3) because POSIX's version is not and this route is extremely messy as it ends up requiring to reimplement bind's libs, and or the whole dns standard.
But this has nothing to do with C's std lib. its posix interface is defined in C, that's all about it.
What's being attempted here is to implement a POSIX defined function in another language and with a different behavior (async).
If there exist a getaddrinfo_a() in the posix standard, go devs wouldn't have had any issue and they would have went the typical route and created a binding between go's call and the posix call provided by the OS.
- jlokier 6y ago> If there exist a getaddrinfo_a() in the posix standard, In principle, if you can assume modern POSIX, then you can also spawn a POSIX thread to call getaddrinfo() and wait asynchronously for the result. In practice getaddrinfo() isn't always thread-safe :/ But it's supposed to be.