[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Continuations in custom port: "cannot invoke continuation from this
Mark H Weaver
Re: Continuations in custom port: "cannot invoke continuation from this context"
Wed, 17 Apr 2019 20:47:33 -0400
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
Earlier I wrote:
> 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
> '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
Since writing this, I've written preliminary patches to add suspendable
I/O support for custom ports:
I'd be curious to hear how it works in your use case.