From: Chris Vine <chris@cvine.freeserve.co.uk>
To: guile-user <guile-user@gnu.org>, guile-devel <guile-devel@gnu.org>
Subject: Re: anyone define port types?
Date: Wed, 22 Jun 2016 23:44:50 +0100 [thread overview]
Message-ID: <20160622234450.773f313f@bother.homenet> (raw)
In-Reply-To: <20160620100157.530fc347@dell.homenet>
On Mon, 20 Jun 2016 10:01:57 +0100
Chris Vine <chris@cvine.freeserve.co.uk> wrote:
> On Mon, 20 Jun 2016 09:34:26 +0200
> Andy Wingo <wingo@pobox.com> wrote:
> [snip]
> > I must not be communicating clearly because this is definitely not
> > what I am proposing. The prompt doesn't service anything, and it's
> > just the one user-space thread which is suspended, and when it
> > suspends, it suspends back to the main loop which runs as usual,
> > timers and all.
> >
> > prompt
> > /------\ /------------\|/-----------\ /------------\ /----------\
> > | main --> run-thread -|>(user code)--> read-char --> waiter |
> > | loop | | ||| | | | | |
> > \------/ \------------/|\-----------/ \------------/ \--|-------/
> > ^ |
> > \-------------------------------/
> > stack grows this way ->
> >
> > The current-read-waiter aborts to a prompt. That prompt is instated
> > when the thread is run or resumed. When you abort to that prompt,
> > you add the FD to the poll set / main loop / *, remember the
> > delimited continuation, and return to the main loop. When the fd
> > becomes readable or the gsource fires or whatever, you reinstate the
> > delimited continuation via a new invocation of run-thread (prompt
> > and all).
>
> Ah right, that is clearer, thank you. There would indeed be a prompt
> for each user glib event source comprised in the "thread" abstraction,
> which the read-waiter (or whatever) aborts to. It is that abstraction
> that I was missing and will need to look at.
I have stirred myself and installed guile-2.1.3. On looking more at
the suspendable ports code it became obvious and I haven't needed to
adopt anything like ethreads with its "thread" abstraction: instead I
have kept the approach already adopted in the guile-a-sync library.
However, the consequence of using suspendable ports instead of C ports
is that the await-getline! procedure (as an example) has been reduced
to a mere 16 lines of code, mainly because it is possible to use (ice-9
rdelim)'s read-line procedure with non-blocking ports.
I have made a new repository for guile-a-sync for use with guile-2.2 and
when I am happy with the new interfaces (and assuming nothing else goes
wrong) I will put it up on github.
This is very nice. Thanks for taking the time to go through it with me.
Chris
next prev parent reply other threads:[~2016-06-22 22:44 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-28 19:04 anyone define port types? Andy Wingo
2016-03-28 23:53 ` Matt Wette
2016-04-05 14:06 ` Mark H Weaver
2016-04-05 23:55 ` Matt Wette
2016-06-11 16:50 ` Andy Wingo
2016-03-29 7:58 ` tomas
2016-03-29 8:52 ` Nala Ginrut
2016-03-30 6:29 ` Panicz Maciej Godek
2016-03-30 11:18 ` Jan Nieuwenhuizen
2016-03-30 17:17 ` Panicz Maciej Godek
2016-03-30 17:53 ` Marko Rauhamaa
2016-03-30 19:02 ` Panicz Maciej Godek
2016-03-30 19:57 ` Marko Rauhamaa
2016-03-31 16:11 ` Barry Fishman
2016-03-31 19:28 ` Marko Rauhamaa
2016-03-30 19:43 ` Jan Wedekind
2016-03-30 20:07 ` Marko Rauhamaa
2016-03-30 21:01 ` Jan Wedekind
2016-03-30 22:44 ` Marko Rauhamaa
2016-03-31 20:42 ` Jan Wedekind
2016-03-31 22:28 ` Marko Rauhamaa
2016-06-11 16:53 ` Andy Wingo
2016-04-01 14:38 ` Ludovic Courtès
2016-06-11 16:57 ` Andy Wingo
2016-04-14 14:08 ` Ludovic Courtès
2016-06-11 17:02 ` Andy Wingo
2016-06-12 8:25 ` Chris Vine
2016-06-19 9:13 ` Andy Wingo
2016-06-19 9:55 ` Marko Rauhamaa
2016-06-19 15:27 ` Andy Wingo
2016-06-19 15:33 ` Chris Vine
2016-06-19 17:48 ` Andy Wingo
2016-06-19 20:09 ` Chris Vine
2016-06-20 3:38 ` William ML Leslie
2016-06-20 6:45 ` Chris Vine
2016-06-20 7:34 ` Andy Wingo
2016-06-20 9:01 ` Chris Vine
2016-06-22 22:44 ` Chris Vine [this message]
2016-06-23 7:36 ` Andy Wingo
2016-06-23 8:56 ` Andy Wingo
2016-06-23 9:24 ` Chris Vine
2016-06-23 9:50 ` Marko Rauhamaa
2016-06-23 10:43 ` Andy Wingo
2016-06-23 11:49 ` William ML Leslie
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=20160622234450.773f313f@bother.homenet \
--to=chris@cvine.freeserve.co.uk \
--cc=guile-devel@gnu.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).