guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scm_i_fraction_reduce thread safety


From: Marius Vollmer
Subject: Re: scm_i_fraction_reduce thread safety
Date: Wed, 21 Jan 2004 01:03:33 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Richard Todd <address@hidden> writes:

> 1) If you are worried about thread safety, the most fool-proof C
> interface probably does not allow separate access to numerator and
> denominator, since they need to be read in one atomic operation to
> ensure consistent results in the face of other mutating code.

Guile fractions can not mutated in general: they always represent one
value.  The mutation that might take place is a reduction, but that
might only happen once.  After a fraction is reduced, it stays that
way.  So when you have a reduced fraction you can safely return the
nominator, say, without having to worry that a later access to the
denominator will return something bogus.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

[Prev in Thread] Current Thread [Next in Thread]