From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: thread cancellation, take 2 Date: Thu, 20 Sep 2007 17:18:51 +0200 Organization: LAAS-CNRS Message-ID: <87abrhl604.fsf@laas.fr> References: <2bc5f8210709200730q61d7973ft8d1da14889efb2f1@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1190301549 27869 80.91.229.12 (20 Sep 2007 15:19:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Sep 2007 15:19:09 +0000 (UTC) Cc: guile-devel@gnu.org To: "Julian Graham" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Sep 20 17:18:59 2007 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IYNnj-00054R-LM for guile-devel@m.gmane.org; Thu, 20 Sep 2007 17:18:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IYNnh-0005f0-Mf for guile-devel@m.gmane.org; Thu, 20 Sep 2007 11:18:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IYNn0-0005Yd-3k for guile-devel@gnu.org; Thu, 20 Sep 2007 11:18:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IYNmy-0005YQ-5m for guile-devel@gnu.org; Thu, 20 Sep 2007 11:18:01 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IYNmx-0005YN-VI for guile-devel@gnu.org; Thu, 20 Sep 2007 11:18:00 -0400 Original-Received: from laas.laas.fr ([140.93.0.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IYNmx-0006LM-I1 for guile-devel@gnu.org; Thu, 20 Sep 2007 11:17:59 -0400 Original-Received: from messiaen.laas.fr (messiaen [IPv6:2001:660:6602:0:230:65ff:fed4:9d20]) by laas.laas.fr (8.13.8/8.13.8) with SMTP id l8KFHs9O025986; Thu, 20 Sep 2007 17:17:54 +0200 (MEST) Original-Received: by messiaen.laas.fr (sSMTP sendmail emulation); Thu, 20 Sep 2007 17:18:51 +0200 X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: Jour de la Raison de =?iso-8859-1?Q?l'Ann=E9e?= 215 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: "Julian Graham" , guile-devel@gnu.org In-Reply-To: <2bc5f8210709200730q61d7973ft8d1da14889efb2f1@mail.gmail.com> (Julian Graham's message of "Thu\, 20 Sep 2007 10\:30\:14 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Spam-Score: -0.001 () NO_RELAYS X-Scanned-By: MIMEDefang at CNRS-LAAS on IPv6:2001:660:6602::2 X-Detected-Kernel: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:6804 Archived-At: Hi, "Julian Graham" writes: > So: Is there a way to safely evaluate SCMs from C after a JMP into a > weird context? (I imagine the on_thread_exit code is called in a > similar state, but it only superficially manipulates SCM values...) Would it be possible to defer execution of the Scheme code (cleanup handlers) to after the C cleanup handler has been called? I.e., the C handler would push the Scheme handlers to a list that would be eventually executed, when Guile is back into a "clean", regular state. > (At the time I asked about this originally, Marius Vollmer suggested > that cancellation be implemented as a system-async -- I think that > approach leaves us with the same issues regarding the GC / stack, > especially now that Guile threads are isomorphic to pthreads.) Indeed, some form of deferred execution appears to be needed here, so that Scheme code is not evaluated right from the C cleanup handler. Now, if system asyncs can do the job, then it's better to use them rather than some ad hoc mechanism as I suggested above. > On a related note, do you guys have any preferences as to the > behavior of cancel-thread? The way I've got it now, joining threads > will receive the value of the final expression in the cleanup-handler > list as the "result" of the canceled thread. Does that make sense? Sounds good. > Also, should the items in the cleanup-handlers list be S-exprs or > should I limit them to being thunks (kind of leaning toward the latter > right now...)? I'd prefer thunks as well, it looks more Schemey. Hope this helps, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel