unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: John Cowan <cowan@ccil.org>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: Guile fibers return values
Date: Sun, 5 Jan 2020 13:46:30 +0100	[thread overview]
Message-ID: <5175eae7-f8f4-d399-91c6-bfe5a30e481d@posteo.de> (raw)
In-Reply-To: <CAD2gp_Qb8FcQQuVpQOM8PPUytnV21BYk7PeKw7FxVOhYH6_sHw@mail.gmail.com>

Thank you for your answer!

I think the example with channels, which I sent later goes in the
direction your are describing : )

Yes, I am not planning on modifying shared state and doing the whole
mutex stuff.

Regards,

Zelphir

On 1/5/20 3:42 AM, John Cowan wrote:
>
>
> On Sat, Jan 4, 2020 at 5:50 PM Zelphir Kaltstahl
> <zelphirkaltstahl@posteo.de <mailto:zelphirkaltstahl@posteo.de>> wrote:
>
>     I have questions regarding the usage of the fibers library. It seems,
>     that I cannot find any way to get a computation result back from a
>     fiber. I also cannot find anything about how to get a value back
>     from a
>     fiber, except for channels.
>
>
> FIbers are much more like coroutines than subroutines: they don't
> return data, they pass it on.  You *can* communicate by mutating
> shared data, but it's asking for trouble because of synchronization
> issues.  Stick to communicating using channels, that's what they are
> for.  Of course if your fiber both sends and receives on channels to
> the same fiber, you risk deadlock if you are not careful to stay
> exactly in sync and avoid output buffering.  Exactly these rules
> apply to shell pipelines, probably the most widespread form of
> concurrency in programming as well as the simplest and most reliable.
>
>
>
> John Cowan          http://vrici.lojban.org/~cowan      
>  cowan@ccil.org <mailto:cowan@ccil.org>
> Deshil Holles eamus.  Deshil Holles eamus.  Deshil Holles eamus.
> Send us, bright one, light one, Horhorn, quickening, and wombfruit. (3x)
> Hoopsa, boyaboy, hoopsa!  Hoopsa, boyaboy, hoopsa!  Hoopsa, boyaboy,
> hoopsa!
>   --Joyce, Ulysses, "Oxen of the Sun"
>


  reply	other threads:[~2020-01-05 12:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 22:49 Guile fibers return values Zelphir Kaltstahl
2020-01-05  2:42 ` John Cowan
2020-01-05 12:46   ` Zelphir Kaltstahl [this message]
2020-01-14 10:59 ` Amirouche Boubekki
2020-01-15  0:04   ` Zelphir Kaltstahl
  -- strict thread matches above, loose matches on Subject: below --
2020-01-05  1:30 Zelphir Kaltstahl
2020-01-05 12:33 ` Chris Vine
2020-01-05 12:58   ` Zelphir Kaltstahl
2020-01-05 14:28     ` Chris Vine
     [not found]     ` <20200105142358.4ad96d15a23a0b947b2d55e3@gmail.com>
2020-01-05 18:22       ` Zelphir Kaltstahl
2020-01-05 21:45         ` Chris Vine
2020-01-06 19:42           ` Zelphir Kaltstahl
2020-01-06 21:14             ` Chris Vine
2020-01-06 21:47               ` John Cowan
2020-01-06 22:45                 ` Zelphir Kaltstahl
2020-01-07  1:36                   ` John Cowan

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=5175eae7-f8f4-d399-91c6-bfe5a30e481d@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=cowan@ccil.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).