From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xin Wang Newsgroups: gmane.lisp.guile.user Subject: The equivalent of racket's break-thread in guile? Date: Fri, 31 May 2013 07:40:36 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0116007a6d0b8504ddf806e0 X-Trace: ger.gmane.org 1369957266 2769 80.91.229.3 (30 May 2013 23:41:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 May 2013 23:41:06 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri May 31 01:41:07 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UiCSx-000107-60 for guile-user@m.gmane.org; Fri, 31 May 2013 01:41:07 +0200 Original-Received: from localhost ([::1]:56407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiCSw-0005GI-Dr for guile-user@m.gmane.org; Thu, 30 May 2013 19:41:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiCSV-0005G0-Ia for guile-user@gnu.org; Thu, 30 May 2013 19:40:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiCST-00027B-6z for guile-user@gnu.org; Thu, 30 May 2013 19:40:39 -0400 Original-Received: from mail-vc0-f172.google.com ([209.85.220.172]:42168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiCST-000276-2X for guile-user@gnu.org; Thu, 30 May 2013 19:40:37 -0400 Original-Received: by mail-vc0-f172.google.com with SMTP id hf12so633239vcb.3 for ; Thu, 30 May 2013 16:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Vfar/Es4Hh8O++1ygu7V5KUVJKtsiKMQOq223J5Skdg=; b=BD8Ef09OVAKHl6Brh9KGT5j0Z/YSIMlQfTw80y1SU1IxaWwc/CXDlcrigDwFuukv0A xujDm74rXIBFNl1JX5W+vsoEQJY/K/B9Ms0j1IlljPkB7nFVWT3gHoBsAIV3h+qnDjWu 0Lvkn+Aw0+5mC4Q2YGAP0leX66BBVDRowcRXczGnMTrMQG6/Ssr1EjmP/0uEO5oUjIie scGOzzIY6jepvIRFVdmStiEWsZNo0bwrzt/OAkKrAyp0/kQSiS1SQgIPD9K/NDf5Kys7 eKGUyDE8cWpwrR0aIioYlHb17L00mNlZCwdVzUQ9yW0g3AjPc9yLCk/AoNwzA5yget2S tqAg== X-Received: by 10.52.232.202 with SMTP id tq10mr6451464vdc.80.1369957236277; Thu, 30 May 2013 16:40:36 -0700 (PDT) Original-Received: by 10.58.56.36 with HTTP; Thu, 30 May 2013 16:40:36 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.172 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10387 Archived-At: --089e0116007a6d0b8504ddf806e0 Content-Type: text/plain; charset=ISO-8859-1 In Racket, break-thread is used to send an break exception to a thread[1]. E. g. (let ((th (thread (lambda () (dynamic-wind (lambda () #t) (lambda () (/ 1 0)) (lambda () (sleep 5) (display "out-guard\n"))))))) (sleep 1) (break-thread th)) For above code, out-guard part of dynmaic-wind will not be interrupted if use break-thread to cancel a thread, and kill-thread will cancel thread immediately. In Guile, the equivalent of kill-thread is cancel-thread, and is there any equivalent of break-thread? [1] http://docs.racket-lang.org/reference/breakhandler.html Regards, Xin Wang --089e0116007a6d0b8504ddf806e0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
In Racket, break-thread is used to sen= d an break exception to a thread[1].

E. g.

(let ((th (t= hread (lambda ()
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 (dynamic-wind
=A0=A0= =A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (lambda () #t)
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (lambda () (/ 1 0))
=A0=A0=A0 =A0=A0= =A0 =A0=A0=A0=A0=A0 (lambda () (sleep 5) (display "out-guard\n"))= )))))

=A0 (sleep 1)
=A0 (break-thread th))

For above= code, out-guard part of dynmaic-wind will not be interrupted if use break-= thread to cancel a thread, and kill-thread will cancel thread immediately.<= br>
In Guile, the equivalent of kill-thread is cancel-thread, and is = there any equivalent of break-thread?
--089e0116007a6d0b8504ddf806e0--