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: advice needed for multi-threading patch Date: Mon, 28 Sep 2009 20:27:14 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1254184054 10619 80.91.229.12 (29 Sep 2009 00:27:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Sep 2009 00:27:34 +0000 (UTC) Cc: Emacs development discussions To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 29 02:27:27 2009 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.50) id 1MsQYw-0008Gv-Iv for ged-emacs-devel@m.gmane.org; Tue, 29 Sep 2009 02:27:26 +0200 Original-Received: from localhost ([127.0.0.1]:45588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsQYv-0000Oc-UK for ged-emacs-devel@m.gmane.org; Mon, 28 Sep 2009 20:27:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsQYq-0000OX-Kv for emacs-devel@gnu.org; Mon, 28 Sep 2009 20:27:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsQYm-0000OK-05 for emacs-devel@gnu.org; Mon, 28 Sep 2009 20:27:19 -0400 Original-Received: from [199.232.76.173] (port=37495 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsQYl-0000OH-Q5 for emacs-devel@gnu.org; Mon, 28 Sep 2009 20:27:15 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:7314 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsQYl-00060j-K5 for emacs-devel@gnu.org; Mon, 28 Sep 2009 20:27:15 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEFAIrwwEpFxIo//2dsb2JhbACBUdYDhB4Fh30 X-IronPort-AV: E=Sophos;i="4.44,469,1249272000"; d="scan'208";a="46762717" Original-Received: from 69-196-138-63.dsl.teksavvy.com (HELO pastel.home) ([69.196.138.63]) by ironport2-out.pppoe.ca with ESMTP; 28 Sep 2009 20:27:14 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 1227B80C4; Mon, 28 Sep 2009 20:27:14 -0400 (EDT) In-Reply-To: (Tom Tromey's message of "Sun, 27 Sep 2009 22:27:01 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.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:115756 Archived-At: > In my view, a let-binding should always be thread-local, and I think > buffer-localness shouldn't affect this. This is enough of a rule to > answer your questions -- but it is just one choice, we could make > others, I suppose. So what should happen in the following case: Thread A, running in buffer B1, runs the following code: (let ((default-directory "/foo")) (with-current-buffer B2 default-directory)) You seem to say that it should return "/foo", but currently it returns something else. Maybe we should try to come up with a run-time test to catch such cases in current Lisp code. A related case is when a process filter or a sentinel is run via accept-process-output: we'd need to be careful to make sure the code is run in the same thread as the code that called accept-process-output. > There are some oddities implied by making buffer-local let-bindings > also be thread-specific. For example, some buffer-locals affect > redisplay, so what the user sees will depend on the thread in which > redisplay is run. Redisplay should be run in a completely separate thread (at least conceptually). Stefan