Hi Caleb, Caleb Ristvedt <caleb.ristv...@cune.org> writes:
> On Thu, Mar 28, 2019 at 12:58 PM Stefan Israelsson Tampe < > stefan.ita...@gmail.com> 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