From: Andrew Tropin <andrew@trop.in>
To: Philip McGrath <philip@philipmcgrath.com>,
Jean Abou Samra <jean@abou-samra.fr>
Cc: guile-devel@gnu.org, Andy Wingo <wingo@igalia.com>
Subject: Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)
Date: Thu, 13 Jul 2023 07:30:47 +0400 [thread overview]
Message-ID: <878rbktrmg.fsf@trop.in> (raw)
In-Reply-To: <7289b28b-d9d5-450e-baea-a51ef9ce61c2@app.fastmail.com>
[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]
On 2023-06-22 17:42, Philip McGrath wrote:
> 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.
How? If value was updated you need to recalculate new value.
>
> 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.
Original implementation was a single argument, but I thought that
variable number of arguments will be more convinient.
--
Best regards,
Andrew Tropin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2023-07-13 3:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 12:20 [PATCH] Add atomic-box-update! function to (ice-9 atomic) Andrew Tropin
2023-06-21 9:06 ` Jean Abou Samra
2023-06-21 9:06 ` Jean Abou Samra
2023-06-21 16:46 ` Andrew Tropin
2023-06-21 16:54 ` Jean Abou Samra
2023-06-22 3:59 ` Andrew Tropin
2023-06-22 5:21 ` Philip McGrath
2023-06-22 9:02 ` Andrew Tropin
2023-06-22 21:42 ` Philip McGrath
2023-07-13 3:30 ` Andrew Tropin [this message]
2023-08-22 10:51 ` Andrew Tropin
2023-08-22 10:59 ` [PATCH v2] " Andrew Tropin
2023-08-22 17:51 ` Maxime Devos
2023-08-24 16:19 ` Andrew Tropin
2023-08-24 15:38 ` [PATCH v3] " Andrew Tropin
2023-09-20 8:17 ` [PATCH v4] " Andrew Tropin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878rbktrmg.fsf@trop.in \
--to=andrew@trop.in \
--cc=guile-devel@gnu.org \
--cc=jean@abou-samra.fr \
--cc=philip@philipmcgrath.com \
--cc=wingo@igalia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).