[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thread cancellation, take 2
From: |
Ludovic Courtès |
Subject: |
Re: thread cancellation, take 2 |
Date: |
Mon, 24 Sep 2007 13:42:56 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Hi,
"Julian Graham" <address@hidden> writes:
> What's useful about this is that you can have several resources at
> different levels of nesting that need to be cleaned up at cancellation
> time, but you only need to worry about pushing and popping handlers
> within your own scope. If people feel that managing the entire list
> at once is more Scheme-y, though, I can change it.
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.
> Great -- I'll deal with the paperwork, add tests, and clean up the
> code as you've suggested. I'll send the revisions to you offline, if
> that's okay.
Please post updated patches on the list as well so others get a chance
to review them.
Thanks!
Ludovic.
- thread cancellation, take 2, Julian Graham, 2007/09/20
- Re: thread cancellation, take 2, Ludovic Courtès, 2007/09/20
- Re: thread cancellation, take 2, Julian Graham, 2007/09/20
- Re: thread cancellation, take 2, Julian Graham, 2007/09/23
- Re: thread cancellation, take 2, Ludovic Courtès, 2007/09/23
- Re: thread cancellation, take 2, Julian Graham, 2007/09/23
- Re: thread cancellation, take 2,
Ludovic Courtès <=
- Re: thread cancellation, take 2, Julian Graham, 2007/09/24
- Re: thread cancellation, take 2, Julian Graham, 2007/09/24
- Re: thread cancellation, take 2, Ludovic Courtès, 2007/09/26
- Re: thread cancellation, take 2, Julian Graham, 2007/09/26