From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: Async DNS lookups Date: Mon, 01 Nov 2010 10:09:16 -0600 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1288634246 29640 80.91.229.12 (1 Nov 2010 17:57:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Nov 2010 17:57:26 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 01 18:57:21 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PCydC-0003og-CD for ged-emacs-devel@m.gmane.org; Mon, 01 Nov 2010 18:57:18 +0100 Original-Received: from localhost ([127.0.0.1]:60724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCydB-0002wE-K6 for ged-emacs-devel@m.gmane.org; Mon, 01 Nov 2010 13:57:17 -0400 Original-Received: from [140.186.70.92] (port=54746 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCwsh-00073f-E9 for emacs-devel@gnu.org; Mon, 01 Nov 2010 12:05:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCwsb-0004z6-71 for emacs-devel@gnu.org; Mon, 01 Nov 2010 12:05:09 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:49426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCwsb-0004yl-0O for emacs-devel@gnu.org; Mon, 01 Nov 2010 12:05:05 -0400 Original-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA1G537b015772 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Nov 2010 12:05:03 -0400 Original-Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA1G526a009813 for ; Mon, 1 Nov 2010 12:05:02 -0400 Original-Received: from parfait.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oA1G516B005881 for ; Mon, 1 Nov 2010 12:05:02 -0400 In-Reply-To: (Lars Magne Ingebrigtsen's message of "Sat, 30 Oct 2010 13:57:22 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132247 Archived-At: >>>>> "Lars" == Lars Magne Ingebrigtsen writes: Lars> I don't really see any easy fixes for this with Emacs' feature set at Lars> the moment. A process filter will block Emacs' "main thread", and it Lars> needs to resolve the addresses, so... Lars> 1) implement a C-level resolving functionality that has a callback that Lars> will be called upon resolving the address. This seems hard. There is a GNU library for this: http://directory.fsf.org/project/c-ares/ Apparently glibc already includes getaddrinfo_a for this. It seems to be undocumented, but this has some info & pointers: http://bitsup.blogspot.com/2008/09/asynchronous-dns-lookups-on-linux-with.html A couple other approaches come to mind as well. You could run the synchronous resolver in a new thread, and have the main thread run the event loop. You could use a small helper program instead of calling the resolver in-process. That is basically the same as the previous idea, substituting a process for a thread. Tom