[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Protecting C code from continuations
From: |
Neil Jerram |
Subject: |
Re: Protecting C code from continuations |
Date: |
Wed, 07 Jul 2004 21:26:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux 2.4.4-4GB i686; en-US; 0.8.1) Gecko/20010515 |
Gary Houston wrote:
I wrote something a while ago that I think is relevant to this. In CVS:
guile/workbook/extension/dynamic-root.text
Thanks Gary, that's interesting. However, it still doesn't do what I'm
looking for, I'm afraid, because I actually want to be able to invoke a
continuation within one C->Scheme entry point that was captured during a
previous C->Scheme entry point.
I now think that I can achieve what I want by making all the C->Scheme
entry points look like this:
(define last-c-continuation #f)
(define (entry-point ...)
(call/cc (lambda (cont)
(set! last-c-continuation cont)
(catch #t
interesting-stuff
exception-handler)
(last-c-continuation #f))))
Then, even if `interesting-stuff' invokes a continuation, it will jump
into a call stack that is identical as far as the high level frames
shown here are concerned; and the new call stack will still invoke
last-c-continuation, thus restoring the stack for the containing C code.
Any comments on this, including whether it will or won't work?
Thanks,
Neil