[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile fibers return values

From: John Cowan
Subject: Re: Guile fibers return values
Date: Sat, 4 Jan 2020 21:42:21 -0500

On Sat, Jan 4, 2020 at 5:50 PM Zelphir Kaltstahl <address@hidden>

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        address@hidden
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 via email to

[Prev in Thread] Current Thread [Next in Thread]