[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Continuations in custom port: "cannot invoke continuation from this
From: |
Mark H Weaver |
Subject: |
Re: Continuations in custom port: "cannot invoke continuation from this context" |
Date: |
Mon, 01 Apr 2019 05:12:45 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi Caleb,
Caleb Ristvedt <address@hidden> writes:
> On Thu, Mar 28, 2019 at 12:58 PM Stefan Israelsson Tampe <
> address@hidden> wrote:
>
>> I have not looked at this more carefully. But I suspect that the code is
>> going to C land and then enters the scheme again
>> via the hooks and then continuations won't work as expected.
> Any idea why it would still be going to C land even with suspendable ports
> installed? The manual says they're implemented in scheme for precisely this
> reason.
'install-suspendable-ports!' replaces only a subset of the C port
functions with Scheme implementations, namely the ones listed in
'port-bindings' in suspendable-ports.scm.
The problem here is the custom port. Custom ports are implemented in C,
and are not reimplemented by suspendable-ports.scm. When you perform
I/O on the custom port, it enters C code in r6rs-ports.c which calls
back into Scheme code to call your custom I/O handlers 'read!' and
'write!'.
Mark
- Re: Continuations in custom port: "cannot invoke continuation from this context",
Mark H Weaver <=