News for hackers. Stuff that matters.
Re:Asynchronous Programming in C# by Joker_vD on Friday September 24, 2021 @11:40AM (#28643916)
Some things simply don't have an async API at the low level, e.g. DNS lookup: there is no asynchronous version of getaddrinfo(3). So if you look at the .NET sources, you'll see that Dns.GetHostEntryAsync pushes a task to a thread pool that calls getaddrinfo(3).

In the end, you arrive at a "sync top-level APIs -- async library APIs -- sync low-level OS APIs" sandwich of dubious efficiency.

Re:Asynchronous Programming in C# by davidfowl on Friday September 24, 2021 @09:16PM (#28649514)
There is on windows. On Linux we queue the requests asynchronously to the same address (golang does similar things)
Re:Asynchronous Programming in C# by chakkepolja on Friday September 24, 2021 @12:43PM (#28644813)
When there's sync OS APIs what's the point of async over threads? I thought async APIs use async or polling version of syscalls and not blocking ones.
Re:Asynchronous Programming in C# by davidfowl on Friday September 24, 2021 @09:18PM (#28649531)
Because there are sometimes better things to do than block more threads. We can asynchronously queue dns requests to the same address (this is what we do in .NET 6)