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: Tue, 09 Dec 2008 12:26:28 -0500 Message-ID: References: <87abbiody1.fsf@master.homenet> <877i6l5d8s.fsf@master.homenet> <874p1npvtj.fsf@master.homenet> <87ej0qci8g.fsf@master.homenet> <87y6yxm7xr.fsf@master.homenet> <87hc5gyn9x.fsf@master.homenet> <87ej0ixx97.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 1228843687 18268 80.91.229.12 (9 Dec 2008 17:28:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2008 17:28:07 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Giuseppe Scrivano Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 09 18:29:10 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 1LA6Nj-0000b0-A8 for ged-emacs-devel@m.gmane.org; Tue, 09 Dec 2008 18:28:23 +0100 Original-Received: from localhost ([127.0.0.1]:51852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LA6MY-0006aj-3S for ged-emacs-devel@m.gmane.org; Tue, 09 Dec 2008 12:27:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LA6MT-0006aS-CE for emacs-devel@gnu.org; Tue, 09 Dec 2008 12:27:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LA6MS-0006a8-9h for emacs-devel@gnu.org; Tue, 09 Dec 2008 12:27:05 -0500 Original-Received: from [199.232.76.173] (port=47538 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LA6MS-0006a2-6R for emacs-devel@gnu.org; Tue, 09 Dec 2008 12:27:04 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:50013) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LA6MS-0003zz-24 for emacs-devel@gnu.org; Tue, 09 Dec 2008 12:27:04 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1LA6Ls-0001Oh-R1; Tue, 09 Dec 2008 12:26:28 -0500 In-reply-to: <87ej0ixx97.fsf@master.homenet> (message from Giuseppe Scrivano on Mon, 08 Dec 2008 20:49:56 +0100) 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:106719 Archived-At: > What is the condition for thread-switching in your latest version? The `yield' primitive must be explicitly called. I think that interface won't work very well, because it would require changing every Lisp program to make it cooperate with other threads. We need to put this into the C level. If making QUIT do this is not safe, we could write another macro YIELD to do it, and call that macro where appropriate. But that macro needs to be very fast when it does NOT switch threads! Here's an idea. Suppose the YIELD macro increments a counter and switches threads (round robin?) when that counter reaches a certain number. Every thread-switch would reset the counter to 0. Of course, waiting (in wait_reading_process_output) would also switch threads. 2.