From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Julian Graham" Newsgroups: gmane.lisp.guile.devel Subject: Re: thread cancellation, take 2 Date: Mon, 24 Sep 2007 11:39:10 -0400 Message-ID: <2bc5f8210709240839k3069f572ne54d10f44680671@mail.gmail.com> References: <2bc5f8210709200730q61d7973ft8d1da14889efb2f1@mail.gmail.com> <87abrhl604.fsf@laas.fr> <2bc5f8210709200836i1267bcc8qa066b4d27f2c3e2@mail.gmail.com> <2bc5f8210709222216rf7aa8ednd380fa8db2975073@mail.gmail.com> <87vea1oe70.fsf@chbouib.org> <2bc5f8210709231139x4ed56fc4q9ae28afdb707457b@mail.gmail.com> <87k5qg2ssf.fsf@laas.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1190648544 21207 80.91.229.12 (24 Sep 2007 15:42:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Sep 2007 15:42:24 +0000 (UTC) To: "=?ISO-8859-1?Q?Ludovic_Court=E8s?=" , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Sep 24 17:42:20 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 1IZq4Z-0004r0-KK for guile-devel@m.gmane.org; Mon, 24 Sep 2007 17:42:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZq4W-0002vz-7A for guile-devel@m.gmane.org; Mon, 24 Sep 2007 11:42:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZq3W-0002P4-8w for guile-devel@gnu.org; Mon, 24 Sep 2007 11:41:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZq3R-0002MJ-CM for guile-devel@gnu.org; Mon, 24 Sep 2007 11:41:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZq3R-0002Lv-55 for guile-devel@gnu.org; Mon, 24 Sep 2007 11:41:01 -0400 Original-Received: from fk-out-0910.google.com ([209.85.128.191]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IZq3Q-0005Qf-DL for guile-devel@gnu.org; Mon, 24 Sep 2007 11:41:00 -0400 Original-Received: by fk-out-0910.google.com with SMTP id 19so1968126fkr for ; Mon, 24 Sep 2007 08:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=oG/JvyrxqXsPaUUFd85G3TQFlmQmKk3UTFJMRZ+w7Qs=; b=gDyBcJXgHZdP+vuirM6Qnj6gteWoukLn2sEu8btccWkQz/hLJ32IhmdqUhjIemt/b55Orkz2Us0oXr94/CdNyb6qxEnswnzVjrGL6h0+eZVcyILrhYPDvSw8Cb95PD0T4wggPto/9614mOe9D0iIVCiJV5oYMbQ3A9M/2T5AuDg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RevFGfvB3+H9x/lydrJuhnwkWN5J9hM+Y38g2D8CdctWuc0sx5p10no43f15ur6Snjrp5qI9NSsmHeNqEflOTrHiatcN2qtTPrYenNXvLNB71hOZpQKu07m02Dd+v1Hzzhfe2Efw9vIWo7AUinDMVXBjlH2By8/Aj3X2y1qWYdw= Original-Received: by 10.82.152.16 with SMTP id z16mr9386232bud.1190648350812; Mon, 24 Sep 2007 08:39:10 -0700 (PDT) Original-Received: by 10.82.175.11 with HTTP; Mon, 24 Sep 2007 08:39:10 -0700 (PDT) In-Reply-To: <87k5qg2ssf.fsf@laas.fr> Content-Disposition: inline X-Detected-Kernel: Linux 2.6 (newer, 2) 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:6812 Archived-At: > I find it more elegant to use closures to that end. I.e., when > installing a handler, you'd write something like this: > > (let ((cleanup (thread-cleanup-procedure (current-thread)))) > (set-thread-cleanup-procedure! (current-thread) > (lambda () > ;; invoke previous handler > (if (procedure? cleanup) > (cleanup)) > ;; clean up... > ))) > > There's a race here in case multiple threads try to change the cleanup > procedure associated with that particular thread at the same time, but I > suppose it is not an issue in practice. Fair enough, re: closures. But why should callers outside the current thread be able to access that thread's cleanup handler procedure? Maybe this isn't a realistic issue, but you could use this to "inject" arbitrary code into a separate thread by setting the cleanup procedure and immediately canceling the thread. Why not treat the handler as thread-specific data? _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel