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: GOOPS and fibers - need help understanding what's wrong, bug in fibers/guile? Date: Wed, 22 Jul 2020 13:28:14 +0100 Message-ID: <20200722132814.ddafae7536dc479408a6513a@gmail.com> References: <20200722015653.630db7f9@interia.pl> <20200722125420.df6acee9612d35be10145c3c@gmail.com> 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="31983"; 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 Wed Jul 22 14:28:32 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 1jyDrK-000894-GA for guile-user@m.gmane-mx.org; Wed, 22 Jul 2020 14:28:30 +0200 Original-Received: from localhost ([::1]:32774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDrJ-00065R-7O for guile-user@m.gmane-mx.org; Wed, 22 Jul 2020 08:28:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDr9-00064v-3O for guile-user@gnu.org; Wed, 22 Jul 2020 08:28:19 -0400 Original-Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:34254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jyDr7-0000pF-IF for guile-user@gnu.org; Wed, 22 Jul 2020 08:28:18 -0400 Original-Received: by mail-wr1-x430.google.com with SMTP id f7so1738190wrw.1 for ; Wed, 22 Jul 2020 05:28:17 -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=xO0HfH9q4O/Q6ul3LDBy7H0tPnFZ+Dx0+EeNa3PkU0U=; b=MHF0Qqww9jqIJmYupKtaW6G+hobW6NFvLO5XaO0rELPb6qUHrDM+myeLuIRqPzeYpq FtGJ3jy9zvKtrGuu20Yhz+4JOxOGu+onx31U4gQcHcRMZ7zPgGmJGGpdfvUcEptY2bW/ 57x+lYqymd0T9pN+A0NX6Vr/r13G9EsYEi4IbKlIaoz+VTfr6ez00em8GePr0eSc4tW6 ZIV+gFMiR67zOZuXSMLnpv1n1+e/51vCm1lxuBLHHFqCDl/TKoZcXa4aPMrHXXAATVja Pr6qdR2qVBiGZvFJGA5oLYd8/D4XImaIipY8kIE+apg0NQnXYPa0/bz96RAy5k/yO/jm 5Cfw== 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=xO0HfH9q4O/Q6ul3LDBy7H0tPnFZ+Dx0+EeNa3PkU0U=; b=EgH+SEahtDLb5YhDV/8RL33kPSOvdFka0NdYfvmbr5dpX/52Bh5ofDGwvfyCFpF1Hw R0lMjdoxxDXoyT0EB9ikZdvacqZAHSOLyPZgwvKUqlawkxtTs0aBHv8wI896RF9whxXQ p5URRNruTsl+fuRTCJSIy0kW7wvnqvBTgDn28nl/bAevF7Qi1DBcKPtTKvaHvSQBOQYk WanJ+H7BwcBP3A1NggGzsi4EOJvkTT+goIrJTfhRdGNR60HCdNhZhOT6c6MsJgo5k+9D V6CojajGx1F8zqi0IzWYn1F7GvSqsD2wQq/hVYjSc4lyJsdG3kDBZA5bE2RUAnJ0GyTy QXfg== X-Gm-Message-State: AOAM530wZo0Y1+uHHTharkVKfPXLwjlXzHw9tFh9DUjT7hZYuK2Z44+h cyOfdYtTerFjC/A9XEpSIUycT6tlA3E= X-Google-Smtp-Source: ABdhPJwXuFB2cSWTHskBsjAWlGE5qgNI3u8F+PVIYR3z1H6CiqBjUMA+Fq/Lz7hDl39beJkRF1xqNQ== X-Received: by 2002:adf:eccd:: with SMTP id s13mr33050754wro.217.1595420895241; Wed, 22 Jul 2020 05:28:15 -0700 (PDT) Original-Received: from bother.homenet ([2.24.141.94]) by smtp.gmail.com with ESMTPSA id c188sm7503965wma.22.2020.07.22.05.28.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:28:14 -0700 (PDT) Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with SMTP id 60A03269E21 for ; Wed, 22 Jul 2020 13:28:14 +0100 (BST) In-Reply-To: <20200722125420.df6acee9612d35be10145c3c@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=vine35792468@gmail.com; helo=mail-wr1-x430.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: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=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-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:16715 Archived-At: On Wed, 22 Jul 2020 12:54:20 +0100 Chris Vine wrote: > On Wed, 22 Jul 2020 01:56:53 +0200 > Jan Wielkiewicz wrote: > > Hello, > > > > I started writing my project in Guile with GOOPS and fibers (I'll > > release it once it stops being a shame and starts working!), but I > > encountered a problem: > > > > The example from fibers' manual doesn't work: > > > > (lambda () > > (spawn-fiber (lambda () (display "hey!\n"))))) > > > > It doesn't print "hey" as documented in the manual. > > I use guile 3.0.4 and fibers 1.0.0 (from Guix). > > (You are missing '(run-fibers' at the beginnng. Presumably this was > just a pasting error on your part.) > > With that omission corrected, it used to work with guile-2.2. Something > seems to have changed with guile-3.0, because it only works for me with > guile-3.0 if you set #:drain? to #t in the call to run-fibers. Without > that, run-fibers appears to return before init-thunk returns. > > So it seems that there is either a bug in the manual or in the fibers > implementation, probably the latter. On further reflection I am not sure if it did used to work with guile-2.2. I think it may be a bug in the manual after all. This works OK: (display (run-fibers (lambda () (let ((channel (make-channel))) (spawn-fiber (lambda () (sleep 1) ;; do some work (put-message channel "hello world"))) (simple-format #t "~a~%" (get-message channel)) "finished\n")))) The point about: (run-fibers (lambda () (spawn-fiber (lambda () (set! v "Set") (display "hey!\n"))))) is that spawn-fiber, and so init-thunk, will return straigntaway with a new fiber object. So I suspect setting #:drain? to #t will resolve your problem. It might be worth reporting the bug in the manual as an issue on the github repository (assuming the above is correct).