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: guile fibers - looking for adivce Date: Sun, 6 Sep 2020 02:47:57 +0200 Message-ID: <20200906024757.58dd34cd@interia.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29825"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Sep 06 00:48:30 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 1kEgyz-0007dT-IQ for guile-user@m.gmane-mx.org; Sun, 06 Sep 2020 00:48:29 +0200 Original-Received: from localhost ([::1]:38506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEgyy-0006Vd-Kc for guile-user@m.gmane-mx.org; Sat, 05 Sep 2020 18:48:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEgyo-0006VV-OQ for guile-user@gnu.org; Sat, 05 Sep 2020 18:48:18 -0400 Original-Received: from smtpo.poczta.interia.pl ([217.74.65.237]:45230) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEgyl-0007zR-UU for guile-user@gnu.org; Sat, 05 Sep 2020 18:48:18 -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 for ; Sun, 6 Sep 2020 00:48:10 +0200 (CEST) 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=1599346090; bh=OdVWt3D/TNQZsADoTS/JXOX9YWRSyuV6VBHoXoMI2DI=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:Date:From:To:Subject: Message-ID:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding:X-Interia-Antivirus; b=oJciVT/b2wuIeTspaVw9bTu8pJG3X88nQWhmmXptnzkk8EuRBsuJwBLTfjqvoU14t MK5GiJYqn3A19sqsa76gIicG/ORb84JwnFcoC76gySlWMywIbBuYDOtZYFlJgGk9An g8QLde+Ecqv++N4iolE8KNKvqrleWpr4kbYGTm48= 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/05 18:48:11 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:16864 Archived-At: Hello, I'm still on my way of integrating Guile Fibers and GOOPS, but I encountered some weird behavior. Say I have an object with with one slot being a vector and two methods accessing the vector concurrently/parallelly. The methods accessing/editing the vector are time consuming and are meant to be ran frequently. Assuming I would like to run the methods on separate fibers, how do I make sure the state of the object doesn't suddenly change during execution of a method? I would like the methods to be able to edit the state of the object, but in a cooperative manner. The weird behavior I've encountered is that sometimes when running the first method (A) and right after starting the second method (B), the method B tries to access the vector before the method A finishes its job. What should I do to make accessing the vector cooperatively, yet to run the time consuming on separate fibers for concurrency? I was thinking about implementing slots in objects as sending and receiving messages instead of regular variables, but still there were some problems with the object state. Could someone explain me what should I do? Thanks in advance Jan Wielkiewicz