From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chetan Pandya Newsgroups: gmane.emacs.devel Subject: Re: multi-threaded Emacs Date: Sun, 7 Dec 2008 19:06:39 -0800 (PST) Message-ID: <97213.26712.qm@web83202.mail.mud.yahoo.com> References: <87y6yrtuhj.fsf@master.homenet> Reply-To: pandyacus@sbcglobal.net NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228705618 30203 80.91.229.12 (8 Dec 2008 03:06:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2008 03:06:58 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org To: Stefan Monnier , Giuseppe Scrivano Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 08 04:08: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 1L9WTY-0005KL-Il for ged-emacs-devel@m.gmane.org; Mon, 08 Dec 2008 04:08:00 +0100 Original-Received: from localhost ([127.0.0.1]:57788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9WSN-0005SB-QI for ged-emacs-devel@m.gmane.org; Sun, 07 Dec 2008 22:06:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L9WSK-0005S3-Qp for emacs-devel@gnu.org; Sun, 07 Dec 2008 22:06:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L9WSI-0005RJ-KQ for emacs-devel@gnu.org; Sun, 07 Dec 2008 22:06:43 -0500 Original-Received: from [199.232.76.173] (port=44006 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9WSI-0005RG-GZ for emacs-devel@gnu.org; Sun, 07 Dec 2008 22:06:42 -0500 Original-Received: from web83202.mail.mud.yahoo.com ([216.252.101.46]:46084) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1L9WSH-00018e-Q5 for emacs-devel@gnu.org; Sun, 07 Dec 2008 22:06:42 -0500 Original-Received: (qmail 26745 invoked by uid 60001); 8 Dec 2008 03:06:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Message-ID; b=dmDj4419fmnPZ5rW3vhmlcnIGVTZpDRhW3lqF2KA0xxO7tSHxCgpmlNvX2p+B6rC2gc8EOLsYdgev/U7Abv+4+1P/XzBId1BsWRWoI0ow5ZQc6YbHDxJxt9iZ2QuI27u5ysozwgfk3Xs8GOPHJ2b/5nOyjoB9czWQ1XA2GKbIrg=; X-YMail-OSG: 344jDI0VM1lSVX2vEg0_cCsdBNk7IKKPnRJglP6pHcZfUDNH1oGPn8hcijQcdI1vOg-- Original-Received: from [75.36.180.162] by web83202.mail.mud.yahoo.com via HTTP; Sun, 07 Dec 2008 19:06:39 PST X-Mailer: YahooMailWebService/0.7.218.2 In-Reply-To: <87y6yrtuhj.fsf@master.homenet> X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) 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:106669 Archived-At: I am wondering if there is eally an expectation build a multi-threading emacs. There are also all of the global variables in C code that might need to be saved and restored e.g. while loading a file. Chetan --- On Sun, 12/7/08, Giuseppe Scrivano wrote: > From: Giuseppe Scrivano > Subject: Re: multi-threaded Emacs > To: "Stefan Monnier" > Cc: rms@gnu.org, emacs-devel@gnu.org > Date: Sunday, December 7, 2008, 11:51 PM > Stefan Monnier writes: > > > > > Switching the value of specpdl is not enough. Try > > > > (progn > > (run-in-thread a-thread '(dotimes (i 2) > > (print "hello") > > (yield))) > > > > (let ((i 5)) > > (while (< i 7) > > (print "world") > > (yield) > > (setq i (1+ i)))) > > > > What Richard suggests is that upon a thread-switch we > walk up the specpdl > > stack, undoing all the bindings, then switch specpdl > to the one of the > > other thread and walk down that one to reestablish the > local bindings of > > the new thread. > > It is exactly what I do in save_thread_bindings () and > restore_thread_bindings (). > > Trying your code (plus initializing the thread and another > ')' at the > end) I have: > > (progn > (run-in-thread a-thread '(dotimes (i 2) > (print "hello") > (yield))) > > (let ((i 5)) > (while (< i 7) > (print "world") > (yield) > (setq i (1+ i))))) > > "hello" > > "world" > > "hello" > > "world" > > > Regards, > Giuseppe