emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asynchronous DNS


From: Alain Schneble
Subject: Re: Asynchronous DNS
Date: Sat, 20 Feb 2016 21:18:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Paul Eggert <address@hidden> writes:

> Lars Ingebrigtsen wrote:
>> I had assumed that getaddrinfo_a would have the normal timeouts that
>> getaddrinfo has -- that it would say that it's failed after a certain
>> number of seconds.  Some testing here (switching off the wifi after
>> issuing a DNS request) seems to indicate that that may not be the case?
>
> My (admittedly limited) understanding is that getaddrinfo_a doesn't
> timeout, and that the normal way to specify timeouts is via
> gai_suspend.

Here is what my humble self understood:

Yes, getaddrinfo_a returns immediately, as it just enqueues a new
request to be processed by the worker threads.  gai_suspend would only
be needed if a thread wants to wait for a response for a given amount of
time, by blocking the calling thread.

But the async-dns implementation that Lars provided uses another
approach instead: it polls by calling gai_error (succeed, failed, in
progress, ...)  repeatedly from wait_reading_process_output.  As
getaddrinfo_a, gai_error does not block.

AFAIU, in the case of gai_suspend, the client would have to call
gai_error as well just after gai_suspend, to inspect the status of the
requests that have completed.  But as gai_suspend would block the
calling thread, it wouldn't be a wise choice for async-dns
implementation in GNU Emacs, as it would essentially block it as well.
But after all, IIUC, using gai_suspend is optional.  So it should just
work properly also with the polling approach currently in place.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]