From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alain Schneble Newsgroups: gmane.emacs.devel Subject: Re: Asynchronous DNS Date: Sat, 20 Feb 2016 21:18:16 +0100 Message-ID: <861t873zlj.fsf@realize.ch> References: <87h9hrnc8x.fsf@gnus.org> <83powfzsqt.fsf@gnu.org> <87y4b393hl.fsf@gnus.org> <83io27ytu3.fsf@gnu.org> <87k2mmzkry.fsf@gnus.org> <83k2mlyet8.fsf@gnu.org> <87lh71nriy.fsf@gnus.org> <8637t8opla.fsf@realize.ch> <871t8skg6c.fsf@gnus.org> <86y4b0n5q2.fsf@realize.ch> <87fux7gb7o.fsf@gnus.org> <83wpqjvd2f.fsf@gnu.org> <87zivfobn4.fsf@gnus.org> <86y4ao5g1c.fsf@realize.ch> <87r3ggdo9f.fsf@gnus.org> <86twlb5yl4.fsf@realize.ch> <83d1rzz1mu.fsf@gnu.org> <86egcc49qu.fsf@realize.ch> <87io1k41cg.fsf@gnus.org> <56C8A89C.4020909@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1455999546 10144 80.91.229.3 (20 Feb 2016 20:19:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2016 20:19:06 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 20 21:19:01 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXDzZ-00080U-9V for ged-emacs-devel@m.gmane.org; Sat, 20 Feb 2016 21:19:01 +0100 Original-Received: from localhost ([::1]:35393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXDzY-0004Ua-AV for ged-emacs-devel@m.gmane.org; Sat, 20 Feb 2016 15:19:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXDzU-0004UM-KL for emacs-devel@gnu.org; Sat, 20 Feb 2016 15:18:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXDzR-0007MJ-EJ for emacs-devel@gnu.org; Sat, 20 Feb 2016 15:18:56 -0500 Original-Received: from clientmail.realize.ch ([46.140.89.53]:4577) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aXDzR-0007MC-2i for emacs-devel@gnu.org; Sat, 20 Feb 2016 15:18:53 -0500 Original-Received: from rintintin.hq.realize.ch.lan.rit ([192.168.0.105]) by clientmail.realize.ch ; Sat, 20 Feb 2016 21:18:35 +0100 Original-Received: from MYNGB (192.168.66.64) by rintintin.hq.realize.ch.lan.rit (192.168.0.105) with Microsoft SMTP Server (TLS) id 15.0.516.32; Sat, 20 Feb 2016 21:18:21 +0100 In-Reply-To: <56C8A89C.4020909@cs.ucla.edu> (Paul Eggert's message of "Sat, 20 Feb 2016 09:55:40 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) X-ClientProxiedBy: rintintin.hq.realize.ch.lan.rit (192.168.0.105) To rintintin.hq.realize.ch.lan.rit (192.168.0.105) X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] X-Received-From: 46.140.89.53 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200337 Archived-At: Paul Eggert 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.