From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: advice needed for multi-threading patch Date: Fri, 28 Aug 2009 22:57:36 -0600 Message-ID: References: <87vdk7xy32.fsf@master.homenet> Reply-To: Tom Tromey NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251521888 11817 80.91.229.12 (29 Aug 2009 04:58:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Aug 2009 04:58:08 +0000 (UTC) Cc: Emacs development discussions To: Giuseppe Scrivano Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 29 06:58:01 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 1MhG0m-0001Db-5W for ged-emacs-devel@m.gmane.org; Sat, 29 Aug 2009 06:58:00 +0200 Original-Received: from localhost ([127.0.0.1]:53629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhG0l-00089q-NT for ged-emacs-devel@m.gmane.org; Sat, 29 Aug 2009 00:57:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhG0b-000889-B5 for emacs-devel@gnu.org; Sat, 29 Aug 2009 00:57:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhG0W-00083u-0g for emacs-devel@gnu.org; Sat, 29 Aug 2009 00:57:47 -0400 Original-Received: from [199.232.76.173] (port=39831 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhG0V-00083j-27 for emacs-devel@gnu.org; Sat, 29 Aug 2009 00:57:43 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:57823) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MhG0S-0001lO-Ti; Sat, 29 Aug 2009 00:57:41 -0400 Original-Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7T4vdxM011303; Sat, 29 Aug 2009 00:57:39 -0400 Original-Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7T4vcZC030103; Sat, 29 Aug 2009 00:57:38 -0400 Original-Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7T4vbZG028963; Sat, 29 Aug 2009 00:57:37 -0400 Original-Received: by opsy.redhat.com (Postfix, from userid 500) id 0E758378171; Fri, 28 Aug 2009 22:57:37 -0600 (MDT) X-Attribution: Tom In-Reply-To: <87vdk7xy32.fsf@master.homenet> (Giuseppe Scrivano's message of "Sat, 29 Aug 2009 02:28:33 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 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:114819 Archived-At: >>>>> "Giuseppe" == Giuseppe Scrivano writes: Giuseppe> I only now saw this thread and multi-threaded Emacs is still Giuseppe> in my wish-list :-) Do you already have some working code? Yeah. Well, I did ... it is not working today because I am in the middle of changing the variable binding implementation and implementing buffer locking. Giuseppe> In my work, I didn't consider threads local storage for two Giuseppe> reasons the first and most important is that elisp packages Giuseppe> (yet?) don't know about it and wouldn't use; the second reason Giuseppe> is that it adds a lot of complexity while I don't see much Giuseppe> benefits so I chose simplicity. I suspect we may be talking about different things. When I say thread-local storage, I just mean having 'let' bindings work properly when two different threads use the same symbol name. In case not: my goal was to write the smallest patch that would yield a usefully multi-threaded Emacs. It seemed to me that the binding issue had to be dealt with somehow, because ignoring it would mean that the resulting Emacs could not run any real programs. As I saw it, the choices were either to undo and redo all the bindings at every context switch, or implement thread-local bindings. I looked into both a bit, and thread-local bindings did not seem too hard, except for defining the semantics of the interaction between multiple threads and buffer-local variables. Right now I have something similar to your patch (except using a single thread-local current_thread pointer instead of arrays); plus changes to the GC and to make DEFVAR_LISP work. Tom