[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)
From: |
Philip McGrath |
Subject: |
Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic) |
Date: |
Thu, 22 Jun 2023 17:42:47 -0400 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-499-gf27bbf33e2-fm-20230619.001-gf27bbf33 |
On Thu, Jun 22, 2023, at 5:02 AM, Andrew Tropin wrote:
> On 2023-06-22 01:21, Philip McGrath wrote:
>>
>> In any case, the current documentation for
>> atomic-box-compare-and-swap! is clear that the comparison is eq?: it
>> just means that, when the behavior of eq? is unreliable, so is the
>> behavior of atomic-box-compare-and-swap!.
>
> Good. Than implementation of atomic-box-update! looks correct to me.
> Any thoughts on including it in (ice-9 atomic)?
>
>>
>> Tangentially, does atomic-box-compare-and-swap! handle spurious
>> failures on architectures like ARM, or does it expose machine
>> semantics to the programmer? Maybe that's covered by details of the
>> C11 memory model, but I don't think "sequential consistency" alone is
>> enough to answer the question.
>>
I think your implementation is correct. If atomic-box-compare-and-swap! does
not handle spurious failures, I think your implementation is still correct, but
a more efficient implementation could retry without an extra call to the update
procedure.
Someone with a better sense of Guile performance might have a view about
whether `apply` is likely to be expensive: alternatively, the update procedure
could be restricted to a single argument, or `case-lambda` could provide a
specialized entry-point.
-Philip
- [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/19
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Jean Abou Samra, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Jean Abou Samra, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Jean Abou Samra, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Philip McGrath, 2023/06/22
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/22
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic),
Philip McGrath <=