[getdns-api] async comments (0.268)
Joe Hildebrand jhildebr
jhildebr
Wed Feb 13 01:24:01 CET 2013
On 2/12/13 2:19 PM, "Phillip Hallam-Baker" <hallam at gmail.com> wrote:
>So do we give that particular developer a callback mechanism they can use
>to throw out multiple queries at once or a convenience function that does
>the multiple queries for them?
Think of an email server. Particularly when it starts up, it needs to do
a ton of DNS queries for each of the mails that were left over in the
queue. Those are completely separate queries; if there was a thread
outstanding for each things get hairy.
>Some people are definitely going to want to muck about with threads. But
>I think most will be happier with a convenience call that hides that from
>them.
The people that don't want an async API can use a different one, or rely
on a wrapper that someone could decide to write for them.
The important thing with threads from the APIs perspective is that you
guarantee as a caller that a particular context is only used on a given
thread at a time. If you need lots of parallelism, you create multiple
contexts. However, if you need lots of threads, you'll have the skill to
deal with this problem - or you shouldn't be using threads in the first
place.
--
Joe Hildebrand
More information about the spec
mailing list