Hi Caleb, Earlier I wrote: > 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!'.
Since writing this, I've written preliminary patches to add suspendable I/O support for custom ports: https://lists.gnu.org/archive/html/guile-devel/2019-04/msg00019.html I'd be curious to hear how it works in your use case. Mark