From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: scm_i_fraction_reduce thread safety Date: Wed, 10 Dec 2003 06:39:36 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87iskpenef.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1071003220 20631 80.91.224.253 (9 Dec 2003 20:53:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2003 20:53:40 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Dec 09 21:53:37 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ATorR-0006jd-01 for ; Tue, 09 Dec 2003 21:53:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ATpoj-000562-Qn for guile-devel@m.gmane.org; Tue, 09 Dec 2003 16:54:53 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ATpoI-00055d-9A for guile-devel@gnu.org; Tue, 09 Dec 2003 16:54:26 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ATpdi-00039u-Le for guile-devel@gnu.org; Tue, 09 Dec 2003 16:44:01 -0500 Original-Received: from [61.8.0.36] (helo=snoopy.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ATpbQ-0002Rr-G2 for guile-devel@gnu.org; Tue, 09 Dec 2003 16:41:08 -0500 Original-Received: from mongrel.pacific.net.au (mongrel.pacific.net.au [61.8.0.107]) by snoopy.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id hB9Kdfno006808 for ; Wed, 10 Dec 2003 07:39:41 +1100 Original-Received: from localhost (ppp159.dyn16.pacific.net.au [61.8.16.159]) by mongrel.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id hB9Kdexs022751 for ; Wed, 10 Dec 2003 07:39:41 +1100 Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 1ATodt-0002Jo-00; Wed, 10 Dec 2003 06:39:37 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3112 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3112 There's a comment in scm_i_fraction_reduce questioning the safety of modifying the given fraction. I think it probably isn't safe, if other threads are looking at the fraction concurrently, and also I suspect two threads running that reduce function itself would not be safe. Not sure what to do about it. I guess the choices would be between some sort of lock, not storing back reduced values, or keeping fractions reduced always. Reducing every so often might be a good idea, since rational arithmetic is a bit notorious for intermediate expression swell. Maybe gc could do something. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel