Hi,
"Julian Graham" <[EMAIL PROTECTED]> 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.
_______________________________________________
Guile-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-devel