unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: Jean Abou Samra <jean@abou-samra.fr>, guile-devel@gnu.org
Cc: Andy Wingo <wingo@igalia.com>
Subject: Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)
Date: Wed, 21 Jun 2023 20:46:48 +0400	[thread overview]
Message-ID: <874jn0pxtz.fsf@trop.in> (raw)
In-Reply-To: <373b9f50a8fb64f98968dc07c6b43d114ac9cce4.camel@abou-samra.fr>

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

On 2023-06-21 11:06, Jean Abou Samra wrote:

> Le mercredi 21 juin 2023 à 11:06 +0200, Jean Abou Samra a écrit :
>> Le lundi 19 juin 2023 à 16:20 +0400, Andrew Tropin a écrit :
>> > +      (if (eq? old-value (atomic-box-compare-and-swap! box old-value new-value))
>> 
>> 
>> Are you sure eq? is a good idea here? (eq? 5 5) is unspecified, for example. Perhaps eqv? would be more appropriate.
>
> (P.S. And according to the manual, even (let ((a 5)) (eq? a a)) is unspecified.)

Make sense, but it's hard for me to say something valuable on this
topic.  Usually, I don't use eq? and don't have enough knowledge of its
internals.  I went the way suggested by the manual: "Returns the
previous value of the box in either case, so you can know if the swap
worked by checking if the return value is eq? to expected."

https://www.gnu.org/software/guile/manual/html_node/Atomics.html

CCed Andy, I guess he knows the right answer and can explain it.

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2023-06-21 16:46 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 [this message]
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
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=874jn0pxtz.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=guile-devel@gnu.org \
    --cc=jean@abou-samra.fr \
    --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).