unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Caleb Ristvedt <caleb.ristvedt@cune.org>
Cc: guile-user@gnu.org
Subject: Re: Continuations in custom port: "cannot invoke continuation from this context"
Date: Mon, 01 Apr 2019 05:12:45 -0400	[thread overview]
Message-ID: <87o95q6qc7.fsf@netris.org> (raw)
In-Reply-To: <CAELvotxs0kCqo4cs6WsONKQhx+SjV4=OdDwHXE+WEx6+S54C1A@mail.gmail.com> (Caleb Ristvedt's message of "Mon, 1 Apr 2019 02:06:16 +0000")

Hi Caleb,

Caleb Ristvedt <caleb.ristvedt@cune.org> writes:

> On Thu, Mar 28, 2019 at 12:58 PM Stefan Israelsson Tampe <
> stefan.itampe@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



  reply	other threads:[~2019-04-01  9:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28  4:30 Continuations in custom port: "cannot invoke continuation from this context" Caleb Ristvedt
     [not found] ` <CAGua6m0eTYuXW3tq8o-pR7fgRH5yi8D6kjF1HdLPgC16Cc2=jg@mail.gmail.com>
2019-04-01  2:06   ` Caleb Ristvedt
2019-04-01  9:12     ` Mark H Weaver [this message]
2019-04-18  0:47       ` Mark H Weaver
2019-04-27 21:04         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o95q6qc7.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=caleb.ristvedt@cune.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).