From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.user Subject: Re: guile fibers - looking for adivce Date: Sun, 6 Sep 2020 20:26:57 +0100 Message-ID: <20200906202657.d6f2861b1e8ba85276121ca6@gmail.com> References: <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="10859"; 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 21:27:05 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 1kF0Jd-0002jP-Jx for guile-user@m.gmane-mx.org; Sun, 06 Sep 2020 21:27:05 +0200 Original-Received: from localhost ([::1]:34738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF0Jc-0001Yu-M7 for guile-user@m.gmane-mx.org; Sun, 06 Sep 2020 15:27:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF0JT-0001Ym-Lv for guile-user@gnu.org; Sun, 06 Sep 2020 15:26:55 -0400 Original-Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:42293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF0JR-000175-Qx for guile-user@gnu.org; Sun, 06 Sep 2020 15:26:55 -0400 Original-Received: by mail-wr1-x42b.google.com with SMTP id c18so13038704wrm.9 for ; Sun, 06 Sep 2020 12:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=knfHe1AeSgE+snNJZvHTIQDFrookby+NIqHzBDar3MQ=; b=AQ7C6iVTC+EvSzy8ZAIRrD8PzRG37kOCZ2Y53KVsq1TWfi9Qa6Cl44XzhWcVnk4Ahr 0dnXu/gpLhE3di3Hwr/MX0oatzOk5p/O1UhvCDxpd9dpdmCr0xYp8JEvlYrQOqZl7p9S ZhJIO/pI/L6cV3gbUZBvgGg9Ctaf5gwsw0gaad8c/hWK6WNzJZmpsk5r4Sd1ZalkNos6 h1CDmjphy8R5i1UxU7qNui8plmdlG2P3dPmJJx44rA55RZH4tx0yoixTVkjegqKuJMbz cDgakXImtMQj5DEtRr/1IwGWsC8eUXJEzjANhIW2kjmJ+dHvPGdrYl8avCDSLOoYcAR1 ZIaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=knfHe1AeSgE+snNJZvHTIQDFrookby+NIqHzBDar3MQ=; b=X5Yoh3qOAM7cH5zowXwX9nks/qPn4iBgIg6z17aQ6hXC6zqCFa3TSLEJ27Z/q/I6bz FO2gD0ZO7C9mITBz8xK1Bcw2kAOYJC0HD60jGD2GbFWq5Cc1c0/xrTV/ouPj1SYapJgE oVm9HbwxtOKXWYSFGBT3IzKZgDCHS5aSi238EVgD3bCyhtkWJ0vwggeZvbPGtmix6xc4 GvYbBQaWhW5cpZPsX5dN4X2bjuwPX/hv9au3W21GhEDRzANRzbLTYKyucTK0RIXbkoDQ /ZATN2TZZZqFprhPU2FmoFPf5REEZ+eCZFMY/nPMz5hUcq1VBvIr5brqQ107R/CYzH6O 35oA== X-Gm-Message-State: AOAM533ji8nm7aGFtV2SWJ44/rYh267g93ffIuq7drLc+YOrkeeiJlRg 8JPNHt9OMeGbZC4choudz0YGulJGesE= X-Google-Smtp-Source: ABdhPJyybOr2JjpAUbGRow+cW7gHGPzMmHJYsI2wk3mwetO4r4Ww790qCIfSo+WtVtxshu1yyKVWYg== X-Received: by 2002:adf:e34e:: with SMTP id n14mr17913706wrj.91.1599420411092; Sun, 06 Sep 2020 12:26:51 -0700 (PDT) Original-Received: from bother.homenet ([2.27.184.179]) by smtp.gmail.com with ESMTPSA id f6sm23820400wro.5.2020.09.06.12.26.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 12:26:50 -0700 (PDT) Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with SMTP id E845F2694E8 for ; Sun, 6 Sep 2020 20:26:57 +0100 (BST) In-Reply-To: <20200906024757.58dd34cd@interia.pl> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=vine35792468@gmail.com; helo=mail-wr1-x42b.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: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, NICE_REPLY_A=-2.69, 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-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:16873 Archived-At: On Sun, 6 Sep 2020 02:47:57 +0200 Jan Wielkiewicz wrote: > 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? You should use channels.