From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.devel Subject: Re: Are there plans for a multi-threaded Emacs? Date: Sun, 30 Nov 2003 16:36:18 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87ekvpx18d.fsf@emptyhost.emptydomain.de> References: <87oevbes4h.fsf@emacswiki.org> <20031117040607.C6C5D79B72@server2.messagingengine.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1070210259 18207 80.91.224.253 (30 Nov 2003 16:37:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 Nov 2003 16:37:39 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Nov 30 17:37:37 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 1AQUZl-0002wy-00 for ; Sun, 30 Nov 2003 17:37:37 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AQUZl-0004RY-00 for ; Sun, 30 Nov 2003 17:37:37 +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 1AQVWs-0006gW-Pv for emacs-devel@quimby.gnus.org; Sun, 30 Nov 2003 12:38:42 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AQVWm-0006gD-NY for emacs-devel@gnu.org; Sun, 30 Nov 2003 12:38:36 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AQVWG-000689-Pm for emacs-devel@gnu.org; Sun, 30 Nov 2003 12:38:35 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AQVWE-00062y-AQ for emacs-devel@gnu.org; Sun, 30 Nov 2003 12:38:02 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AQUYm-0003be-00 for ; Sun, 30 Nov 2003 17:36:36 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AQUYj-0003bT-00 for ; Sun, 30 Nov 2003 17:36:33 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AQUYj-0004i1-00 for ; Sun, 30 Nov 2003 17:36:33 +0100 Original-Lines: 27 Original-X-Complaints-To: usenet@sea.gmane.org User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:uXqnSxMptnl4s5AOHZbVP148Ed8= 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:18222 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18222 Miles Bader writes: > Consider a simple bit of elisp code: (setq GLOBAL (cons 'x GLOBAL)) > In a pre-emptively threaded emacs, another thread could run between > accessing GLOBAL and setting it. Whoops. Well, I don't know a lot about threading, but Java, at least, has the same problem: you need to synchronize access to a variable to prevent such things from happening. By default, synchronized access is turned off. So if all of what is now in Emacs continues to run in a single thread, and you just provide a function to create a new thread and run stuff in that new thread, then it would be the responsibility of the people creating threads to make sure that they don't step on each other's toes. Then the remaining problem is that possibly a lot of functions cannot be safely used because they access global variables. But that is just something that people will have to live with, and maybe it will get better over time. I think that it will be good enough at least for some packages to do part of their work in the background. What do people think? Maybe I missed something obvious... Kai