From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Are there plans for a multi-threaded Emacs? Date: 03 Dec 2003 15:29:42 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <87oevbes4h.fsf@emacswiki.org> <20031117040607.C6C5D79B72@server2.messagingengine.com> <87ekvpx18d.fsf@emptyhost.emptydomain.de> <4nad6cikxy.fsf@holmes.bwh.harvard.edu> <87ptf5zn4k.fsf@kanga.tapsellferrier.co.uk> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1070483674 17457 80.91.224.253 (3 Dec 2003 20:34:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Dec 2003 20:34:34 +0000 (UTC) Cc: Ted Zlatanov , rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Dec 03 21:34:30 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ARdhe-0007xu-00 for ; Wed, 03 Dec 2003 21:34:30 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ARdhe-0004dA-00 for ; Wed, 03 Dec 2003 21:34:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ARecL-0005kF-Vn for emacs-devel@quimby.gnus.org; Wed, 03 Dec 2003 16:33:05 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ARebh-0005gT-SP for emacs-devel@gnu.org; Wed, 03 Dec 2003 16:32:25 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AReb5-0005Yb-JG for emacs-devel@gnu.org; Wed, 03 Dec 2003 16:32:18 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AReaW-0005OW-Jc; Wed, 03 Dec 2003 16:31:12 -0500 Original-Received: from vor.iro.umontreal.ca (vor.iro.umontreal.ca [132.204.24.42]) by mercure.iro.umontreal.ca (8.12.9/8.12.9) with ESMTP id hB3KThbj006632; Wed, 3 Dec 2003 15:29:43 -0500 Original-Received: by vor.iro.umontreal.ca (Postfix, from userid 20848) id 21F043CFD9; Wed, 3 Dec 2003 15:29:43 -0500 (EST) Original-To: Nic Ferrier In-Reply-To: <87ptf5zn4k.fsf@kanga.tapsellferrier.co.uk> Original-Lines: 28 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-DIRO-MailScanner: Found to be clean X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:18336 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18336 > And anything doing similar things using dynamic scope as well (at > least when a variable isn't local to the function but from a > previously called function). So that's about everything. I think the nastiest aspect I know of is the interaction of dynamic scope with buffer-local bindings: (with-current-buffer A (setq default-directory fooA) (let ((default-directory barA)) (with-current-buffer B (setq default-directory fooB) (let ((default-directory barB)) (with-current-buffer A default-directory))))) This will return `barA': i.e. the value of default-directory in buffer A is temporarilly changed to barA. But this is a "global" variable (from a threading point of view) changed by a let-binding (generally considered as a thread-local, stack-allocated variable). So I think fine-grained threading in elisp is basically out. But maybe if we add one lock per buffer and we make `with-current-buffer' acquire&release the lock we might get a workable model, albeit with a necessarily very coarse grain which is probably OK for most uses. Of course, extreme care will still be needed, but that's OK. Stefan