From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Vinicius Jose Latorre Newsgroups: gmane.emacs.devel Subject: Re: Are there plans for a multi-threaded Emacs? Date: Sun, 30 Nov 2003 16:01:24 -0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200311301801.hAUI1O43027627@hillux.cpqd.com.br> References: <87oevbes4h.fsf@emacswiki.org> <20031117040607.C6C5D79B72@server2.messagingengine.com> <87ekvpx18d.fsf@emptyhost.emptydomain.de> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1070217305 29996 80.91.224.253 (30 Nov 2003 18:35:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 Nov 2003 18:35:05 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Nov 30 19:35:02 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 1AQWPO-0007hR-00 for ; Sun, 30 Nov 2003 19:35:02 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AQWPO-0005jU-00 for ; Sun, 30 Nov 2003 19:35:02 +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 1AQXLp-0006LK-Sc for emacs-devel@quimby.gnus.org; Sun, 30 Nov 2003 14:35:25 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AQXFE-0004TY-O9 for emacs-devel@gnu.org; Sun, 30 Nov 2003 14:28:36 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AQX7h-0002oP-N4 for emacs-devel@gnu.org; Sun, 30 Nov 2003 14:21:20 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AQX7e-0002m4-4d for emacs-devel@gnu.org; Sun, 30 Nov 2003 14:20:46 -0500 Original-Received: from [200.231.0.62] (helo=duque.cpqd.com.br) by mx20.gnu.org with esmtp (Exim 4.24) id 1AQVv4-0003D3-2j for emacs-devel@gnu.org; Sun, 30 Nov 2003 13:03:42 -0500 Original-Received: from fw-cpqd (dmz-int.cpqd.com.br [200.231.0.35]) by duque.cpqd.com.br (8.11.6p2/8.11.6) with SMTP id hAUI4Ah12547; Sun, 30 Nov 2003 16:04:10 -0200 Original-Received: from dragon.cpqd.com.br ([10.202.48.9]) by fw-cpqd; Sun, 30 Nov 2003 15:05:05 -0300 (EST) Original-Received: from hillux.cpqd.com.br (hillux [10.202.224.7]) by dragon.cpqd.com.br (8.11.6+Sun/8.11.6) with ESMTP id hAUI0gv14506; Sun, 30 Nov 2003 16:00:42 -0200 (EDT) Original-Received: (from vinicius@localhost) by hillux.cpqd.com.br (8.12.8/8.12.8/Submit) id hAUI1O43027627; Sun, 30 Nov 2003 16:01:24 -0200 Original-To: Kai Grossjohann In-reply-to: <87ekvpx18d.fsf@emptyhost.emptydomain.de> (message from Kai Grossjohann on Sun, 30 Nov 2003 16:36:18 +0000) X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details 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:18224 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18224 Kai Grossjohann writes: > 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... I also don't know a lot about threads, but CHILL (old) language also has a mechanism of mutual exclusion. So, one could define a thread, other defines another thread, if both of them need to share some resource (variables) they define a region of mutual exclusion where the resources (variables) can be accessed only by procedure calling. Maybe I also missed something obvious... Vinicius