From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jan Wielkiewicz Newsgroups: gmane.lisp.guile.user Subject: Re: guile fibers - looking for adivce Date: Mon, 7 Sep 2020 18:56:27 +0200 Message-ID: <20200907185627.72eca419@interia.pl> References: <20200906024757.58dd34cd@interia.pl> 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="19501"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Aleix Conchillo =?UTF-8?B?RmxhcXXDqQ==?= Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Sep 07 16:56:49 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 1kFIZd-0004v1-0e for guile-user@m.gmane-mx.org; Mon, 07 Sep 2020 16:56:49 +0200 Original-Received: from localhost ([::1]:44226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFIZb-0000ha-Tn for guile-user@m.gmane-mx.org; Mon, 07 Sep 2020 10:56:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFIZS-0000hI-4O for guile-user@gnu.org; Mon, 07 Sep 2020 10:56:38 -0400 Original-Received: from smtpo.poczta.interia.pl ([217.74.65.237]:36811) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFIZP-0002Ex-6s for guile-user@gnu.org; Mon, 07 Sep 2020 10:56:37 -0400 X-Interia-R: Interia X-Interia-R-IP: 89.64.43.25 X-Interia-R-Helo: Original-Received: from localhost (89-64-43-25.dynamic.chello.pl [89.64.43.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by poczta.interia.pl (INTERIA.PL) with ESMTPSA; Mon, 7 Sep 2020 16:56:28 +0200 (CEST) In-Reply-To: X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1599490589; bh=wbGEr9M8EQqsxyaOeVLo5vHBcXGWqWCOmcsxo9MgX9E=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:Date:From:To:Cc: Subject:Message-ID:In-Reply-To:References:X-Mailer:MIME-Version: Content-Type:Content-Transfer-Encoding:X-Interia-Antivirus; b=n/THFGG6f4AmbUGyH06CRDoOrNYjC/p5Hlj9InHf222dubvugPn5VTUbuIYUNoFD4 zvVawjHKTadP8yjDmRJyIADgWbuKDIxvR93v64U5ws3SQHvv5W1yGwKTuWLvzoIol8 1Ib0T2kmOlpqphMTm6psPG0HAHlfhNRjsXg2guME= Received-SPF: pass client-ip=217.74.65.237; envelope-from=tona_kosmicznego_smiecia@interia.pl; helo=smtpo.poczta.interia.pl X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/07 10:34:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:16877 Archived-At: Hi! Dnia 2020-09-05, o godz. 18:19:49 Aleix Conchillo Flaqu=C3=A9 napisa=C5=82(a): > Hi! >=20 > On Sat, Sep 5, 2020 at 3:48 PM Jan Wielkiewicz < > tona_kosmicznego_smiecia@interia.pl> wrote: >=20 > I believe sharing the same object by the two fibers defeats the > purpose of message passing, because with the way you are doing it you > find exactly the problem you are having and the only way to fix this > is by using mutexes. That is, you are trying to use fibers as you > would use regular threads sharing a resource. Instead, there should > probably be a main fiber (that holds the object) and send messages > (with the data needed from the object) to 2 other fibers (those would > be your methods A and B). I see, thank you for explanation. This allowed me to understand the problem doesn't lie in the way I was trying to implement my messaging through fibers, but rather in the way I was using GOOPS - my custom method for initializing slots called next-method after doing everything what caused some weird problems with allocation. Are threads and mutexes worth using, if there are fibers already?=20 I know I'll have to learn this eventually, to fully master programming, but I'm not sure if there's a great advantage over fibers. >=20 > I haven't used fibers extensively, but I've used Go quite a bit which > follows the same pattern of channels and message passing and this is > how you would do it. >=20 > Also, the fibers manual also suggests this approach: > https://github.com/wingo/fibers/wiki/Manual#33-mutation Yeah, I've read the manual like three times already, but Andy is somethimes writing sentences from outer space, including the GOOPS manual. This isn't the level of English I'm currently on. I guess I'll write some self-explaining examples of GOOPS after I fully understand it. > That said, I might be wrong though. >=20 > Hope this helps, >=20 > Aleix Thanks for explanation, this made my thinking much cleaner. I can get back to experimenting now! Jan Wielkiewicz