From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Async DNS lookups Date: Thu, 04 Nov 2010 17:32:42 -0400 Message-ID: References: <35456.130.55.118.19.1288819785.squirrel@webmail.lanl.gov> <49950.130.55.118.19.1288903227.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: dough.gmane.org 1288906496 17440 80.91.229.12 (4 Nov 2010 21:34:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 4 Nov 2010 21:34:56 +0000 (UTC) Cc: Andreas Schwab , emacs-devel@gnu.org To: herring@lanl.gov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 04 22:34:52 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 1PE7SL-0007EO-5L for ged-emacs-devel@m.gmane.org; Thu, 04 Nov 2010 22:34:49 +0100 Original-Received: from localhost ([127.0.0.1]:38804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PE7SK-0004lZ-Kn for ged-emacs-devel@m.gmane.org; Thu, 04 Nov 2010 17:34:48 -0400 Original-Received: from [140.186.70.92] (port=50000 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PE7QU-000320-Ew for emacs-devel@gnu.org; Thu, 04 Nov 2010 17:33:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PE7QK-0001GZ-5R for emacs-devel@gnu.org; Thu, 04 Nov 2010 17:32:53 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:47664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PE7QK-0001GE-2r for emacs-devel@gnu.org; Thu, 04 Nov 2010 17:32:44 -0400 Original-Received: from ceviche.home ([70.80.93.153]) by vl-mo-mrz23.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0LBD006HQQI9M490@vl-mo-mrz23.ip.videotron.ca> for emacs-devel@gnu.org; Thu, 04 Nov 2010 17:32:33 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id E3E0A660F5; Thu, 04 Nov 2010 17:32:42 -0400 (EDT) In-reply-to: <49950.130.55.118.19.1288903227.squirrel@webmail.lanl.gov> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:132376 Archived-At: > And then you don't want to lock the pending_funcalls variable after all: > you want to have a lock on the pending_c_funcalls and do something like > /* DNS thread */ x-> data=lookup(...); /* slow */ > lock(pending_c_funcalls_mutex); x-> next=pending_c_funcalls; > pending_c_funcalls=x; > unlock(pending_c_funcalls_mutex); > /* main thread */ > lock(pending_c_funcalls_mutex); > for(;pending_c_funcalls;pending_c_funcalls=pending_c_funcalls->next) > pending_funcalls=Fcons(convert_async(pending_c_funcalls), > pending_funcalls); > unlock(pending_c_funcalls_mutex); > /* ...existing Ffuncall() code... */ > Right? Right, except that instead of pending_funcalls=Fcons(convert_async(pending_c_funcalls), pending_funcalls); I'd just do pending_c_funcalls->f (pending_c_funcalls->arg); -- Stefan