From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: multi-threaded Emacs Date: Fri, 05 Dec 2008 10:36: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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228491471 9229 80.91.229.12 (5 Dec 2008 15:37:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2008 15:37:51 +0000 (UTC) Cc: gscrivano@gnu.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 05 16:38:54 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 1L8clZ-0006K7-3Q for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2008 16:38:53 +0100 Original-Received: from localhost ([127.0.0.1]:37629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8ckO-0007Al-Ef for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2008 10:37:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L8cjo-0006s3-7a for emacs-devel@gnu.org; Fri, 05 Dec 2008 10:37:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L8cjm-0006r2-J4 for emacs-devel@gnu.org; Fri, 05 Dec 2008 10:37:03 -0500 Original-Received: from [199.232.76.173] (port=40993 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8cjm-0006qv-7i for emacs-devel@gnu.org; Fri, 05 Dec 2008 10:37:02 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:2866 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L8cjj-0004df-PN; Fri, 05 Dec 2008 10:36:59 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvoEAGrZOEnO+Jkl/2dsb2JhbACBbc16gwWBJg X-IronPort-AV: E=Sophos;i="4.33,721,1220241600"; d="scan'208";a="30695507" Original-Received: from 206-248-153-37.dsl.teksavvy.com (HELO pastel.home) ([206.248.153.37]) by ironport2-out.teksavvy.com with ESMTP; 05 Dec 2008 10:36:58 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id DB5C284A9; Fri, 5 Dec 2008 10:36:57 -0500 (EST) In-Reply-To: (Richard M. Stallman's message of "Thu, 04 Dec 2008 21:59:03 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) 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:106611 Archived-At: > Actually, yielding in QUIT will take a lot of work. It's definitely not > "cooperative" seen from Elisp's point of view (where QUIT can be run > implicitly all over the place). > I am surprised. Perhaps you're right, but why do you think so? > Anywhere that calls QUIT is a place where it is safe for an error to happen, > so why not a thread switch? 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'. So before this level of concurrency can be made to work we'll need to fix dynamic scoping to be "per-thread" rather than global. Note that the `yield' primitive won't be easy to use for the same kind of reason (until we fix dynamic-scoping that is). Stefan