From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.user Subject: Re: guile fibers - looking for adivce Date: Tue, 8 Sep 2020 10:56:25 -0700 Message-ID: References: <20200906024757.58dd34cd@interia.pl> <20200907185627.72eca419@interia.pl> <20200908084823.ce82ef1386b3bc0609599f8a@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1822"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Chris Vine Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Sep 08 19:56:52 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFhrQ-0000MA-9j for guile-user@m.gmane-mx.org; Tue, 08 Sep 2020 19:56:52 +0200 Original-Received: from localhost ([::1]:53544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFhrP-0008MM-4k for guile-user@m.gmane-mx.org; Tue, 08 Sep 2020 13:56:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFhrE-0008L7-Ju for guile-user@gnu.org; Tue, 08 Sep 2020 13:56:40 -0400 Original-Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]:41674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFhrC-0003pN-K4 for guile-user@gnu.org; Tue, 08 Sep 2020 13:56:40 -0400 Original-Received: by mail-lj1-x22c.google.com with SMTP id y4so36481ljk.8 for ; Tue, 08 Sep 2020 10:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=of3A4ITYYeSU6bZAEZHZHStOGX0vikjEaFUfergV8ZU=; b=p0wMdwPcmmKhkbRKBG7KQdRDCSexm3yyAT3bQ+ymIUr22sAwl6UrQ7iFNSnr6FvEQX nGjTdAEvohCSd9Vr7X7FCn20C1iuLB0lED8rIdGQej0OMZLlnHRfeDqfK5S8p2+I9Qc4 ll5wUn4CuvDsOZgTVSCmU2d02Oehw/AWc30nDtfWfhaePDiioV5Ryl/h+k2YA5Z9AU/P 6kxks8Nzf1JMkkR8UXQNnQFXThHXvlmfPS6kTypGLjSqEVrR6jRlvpVoFh5spJ+eJdNz YCzIuvg2hVPtSGAb+ORpoehfyZaEI4/oaTDrjnBfnilux9AsOBotjwoaup2+PQZy4UY5 +YKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=of3A4ITYYeSU6bZAEZHZHStOGX0vikjEaFUfergV8ZU=; b=oIYMp5MbyZgz6mGCBxHokJbl02FhaFiTwO9l5vkD3bRz6WNvEdWjZK73FYX3jhHmQe dhLG1//R8pPB7DM19cQkrxTxIcDhz3sNoo3XPZaByB8mhDKdHNDPuhrechRDoF2avK1j v0K4ENN4x0cjkjUkpXp9eya3fGiUJXwxnV8E52QyPnyOrYRLoT112ZjGD4bQzC46NxvK +jLS77YzUEYx3OmXmNqKJTjGuzeq8FOLaZwBGDWRl/fbIw66HBDMefbNxX+5P0jjpd5Q IFN6Hu7fL7ysUUlAtIvNXQPi00QBG5Ar4sEPeontd4u2lp/UWWLdJ3iqSMXth51IY1Xe XJrg== X-Gm-Message-State: AOAM5326L7GOcZ23c6BJPyqlT09iSO+d0a4P+uNI/XV5HjMuqJDy2GvE C6YrANt2x7mj6lxwTQqfV38PPqjXMTLfmWsQLKE= X-Google-Smtp-Source: ABdhPJxRglHvmk/mOLxP/s3v5O9sQdibytfMgwPux9rQXYmrgN1qL4aCzyl0OqELgAaZoT8vm2aaqHs4v/RPWqDwZUA= X-Received: by 2002:a2e:9854:: with SMTP id e20mr4546512ljj.152.1599587796353; Tue, 08 Sep 2020 10:56:36 -0700 (PDT) In-Reply-To: <20200908084823.ce82ef1386b3bc0609599f8a@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=aconchillo@gmail.com; helo=mail-lj1-x22c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16893 Archived-At: On Tue, Sep 8, 2020 at 12:48 AM Chris Vine wrote: > On Mon, 7 Sep 2020 17:25:38 -0700 > Aleix Conchillo Flaqu=C3=A9 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 option= s: > > > > - 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 thi= s > > 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