From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard M Stallman Newsgroups: gmane.emacs.devel Subject: Re: multi-threaded Emacs Date: Sat, 06 Dec 2008 14:25:57 -0500 Message-ID: References: <87abbiody1.fsf@master.homenet> <877i6l5d8s.fsf@master.homenet> <874p1npvtj.fsf@master.homenet> <87ej0qci8g.fsf@master.homenet> <87y6yxm7xr.fsf@master.homenet> Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: ger.gmane.org 1228591617 17599 80.91.229.12 (6 Dec 2008 19:26:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Dec 2008 19:26:57 +0000 (UTC) Cc: gscrivano@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 06 20:28:01 2008 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 1L92oh-00065I-8K for ged-emacs-devel@m.gmane.org; Sat, 06 Dec 2008 20:27:51 +0100 Original-Received: from localhost ([127.0.0.1]:46463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L92nW-0001Ck-75 for ged-emacs-devel@m.gmane.org; Sat, 06 Dec 2008 14:26:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L92nR-0001CJ-8F for emacs-devel@gnu.org; Sat, 06 Dec 2008 14:26:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L92nO-0001BS-VS for emacs-devel@gnu.org; Sat, 06 Dec 2008 14:26:32 -0500 Original-Received: from [199.232.76.173] (port=35123 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L92nO-0001BO-RL for emacs-devel@gnu.org; Sat, 06 Dec 2008 14:26:30 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:49949) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L92nO-0000sW-HF for emacs-devel@gnu.org; Sat, 06 Dec 2008 14:26:30 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1L92mr-0000oK-PR; Sat, 06 Dec 2008 14:25:58 -0500 In-reply-to: (message from Stefan Monnier on Fri, 05 Dec 2008 10:36:57 -0500) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:106633 Archived-At: It will be safe in the sense that it won't cause a crash. But it will mess up Elisp's semantics. Consider: (dotimes (i 1000) (toto)) if you run this code twice in separate threads and allow context switches at QUIT, then you'll basically be doing "preemptive concurrency" seen from Elisp's point of view. Among other things, the two threads will be fighting over the value of `i'. Each thread should have its own local bindings. To do this requires swapping bindings in and out of the specpdls when switching threads. It is not hard. This makes thread switches slower, and that makes it desirable to do them less often.