unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: Chris Vine <vine35792468@gmail.com>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: guile fibers - looking for adivce
Date: Tue, 8 Sep 2020 10:56:25 -0700	[thread overview]
Message-ID: <CA+XASoW1fhMFfzHMqaPTuopxqgh1LMn9b8puAcwE6gHi-fv+kw@mail.gmail.com> (raw)
In-Reply-To: <20200908084823.ce82ef1386b3bc0609599f8a@gmail.com>

On Tue, Sep 8, 2020 at 12:48 AM Chris Vine <vine35792468@gmail.com> wrote:

> On Mon, 7 Sep 2020 17:25:38 -0700
> Aleix Conchillo Flaqué <aconchillo@gmail.com> wrote:
> [snip]
> > To be honest, I've never used GOOPS so things might be a bit more
> > complicated there, I don't know. But it sounds like you have two options:
> >
> > - Create a fiber with the object and pass data from the object using
> > channels to other fibers. Then return data to the main fiber (or the
> fiber
> > that has the object) through a channel and update your object.
> > - Make the object global and have fibers that update the object. In this
> > case you would need to use mutexes.
> >
> > Or maybe you find another way?
>
> The OP should use channels.  It is a bad idea to mix mutexes (which are
> a construct for native OS threads) with fibers, because fibers run as
> delimited continuations, a group of which may be running on a
> particular thread.  To synchronize fibers, you use channels.
>
> Guile's atomic variables (boxes) are available and can be used with
> fibers because they do not block, but to use them you really need to
> know what you are doing, just as you do if you are using them in C.
> Atomic variables do synchronize memory, but they do not provide mutual
> exclusion (they don't block) and so require expert skills: don't use
> them if you don't know how to use atomic compare-and-swap correctly.
>
> This is what the guile fibers manual has to say:
>
> [snip]
>
>
Ooops, duh... Thank you Chris! I don't know what I was thinking when I
wrote that, I guess just about Go. Funny enough, I read that fibers section
about mutexes the day before, so it clearly didn't stick.

So, Jan, ignore my last email and stick to channels. My apologies for the
confusion.

Aleix


  reply	other threads:[~2020-09-08 17:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-06  0:47 guile fibers - looking for adivce Jan Wielkiewicz
2020-09-06  0:42 ` Zelphir Kaltstahl
2020-09-07 16:34   ` Jan Wielkiewicz
2020-09-06  1:19 ` Aleix Conchillo Flaqué
2020-09-07 16:56   ` Jan Wielkiewicz
2020-09-08  0:25     ` Aleix Conchillo Flaqué
2020-09-08  7:48       ` Chris Vine
2020-09-08 17:56         ` Aleix Conchillo Flaqué [this message]
2020-09-10  1:05       ` Jan Wielkiewicz
2020-09-06 19:26 ` Chris Vine

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=CA+XASoW1fhMFfzHMqaPTuopxqgh1LMn9b8puAcwE6gHi-fv+kw@mail.gmail.com \
    --to=aconchillo@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=vine35792468@gmail.com \
    /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).