From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Tropin Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic) Date: Wed, 21 Jun 2023 20:46:48 +0400 Message-ID: <874jn0pxtz.fsf@trop.in> References: <87jzvztzi3.fsf@trop.in> <373b9f50a8fb64f98968dc07c6b43d114ac9cce4.camel@abou-samra.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37721"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andy Wingo To: Jean Abou Samra , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Jun 21 18:47:22 2023 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qC0zK-0009Vf-1I for guile-devel@m.gmane-mx.org; Wed, 21 Jun 2023 18:47:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC0z0-000688-Ox; Wed, 21 Jun 2023 12:47:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC0yz-00067w-EM for guile-devel@gnu.org; Wed, 21 Jun 2023 12:47:01 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC0yx-0006pi-DI for guile-devel@gnu.org; Wed, 21 Jun 2023 12:47:01 -0400 X-GND-Sasl: andrew@trop.in DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1687366015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iAooJT45jJmYB/1bCv1abZZQxpSeAWR0cUo8Z2oAu7k=; b=UJtR9LmNuodbUDKxnxt6DWZtDbCJDjYEFpYN1E0evmgX1pFGkVv0aY1iwHloZNsUncc0Hy Qwg5tynNBEb4Ml4FZDre63TjqDuv5s1oOAulHKy0aAjEyBe9DfCPwewQw9yo13vDkQfZDm JJIcokuIZmT01G9Nb1vmT6Nu5ve2AGsYMjUBDKjS1KIo3UB22JFxykoP3F2E+f15/T5rlS eiaLSt0+XAXTNLRQmCTFiAiXCyASNEn5lSssO/AIA3vGSdJaTzSNLXNyiVV7ovTchc4cHz CKAzqWNENaoa2r6bXa3MXmK3UxUAX+ssTzDQojKeV7UtpRESH0M6H4HvDi+PnA== X-GND-Sasl: andrew@trop.in X-GND-Sasl: andrew@trop.in Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 8E40660009; Wed, 21 Jun 2023 16:46:54 +0000 (UTC) In-Reply-To: <373b9f50a8fb64f98968dc07c6b43d114ac9cce4.camel@abou-samra.fr> Received-SPF: pass client-ip=217.70.183.195; envelope-from=andrew@trop.in; helo=relay3-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21869 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-06-21 11:06, Jean Abou Samra wrote: > Le mercredi 21 juin 2023 =C3=A0 11:06 +0200, Jean Abou Samra a =C3=A9crit= =C2=A0: >> Le lundi 19 juin 2023 =C3=A0 16:20 +0400, Andrew Tropin a =C3=A9crit=C2= =A0: >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (eq? old-value (atomic-box-compare= -and-swap! box old-value new-value)) >>=20 >>=20 >> Are you sure eq? is a good idea here? (eq? 5 5) is unspecified, for exam= ple. Perhaps eqv? would be more appropriate. > > (P.S. And according to the manual, even (let ((a 5)) (eq? a a)) is unspec= ified.) 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. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmSTKXgACgkQIgjSCVjB 3rAeGxAAgUGc2d6943hIB/kzOgJr7AeDk25QUL8Mz5Lx0rFGHLWqaZYwyhLFytqd eOED6VNX8iqT440af84cNvxIcbWfjwvvzN5RnbS2D77wXK9yQGWaarOZmMZxiaa0 OQzqbwde0WRTE5l7MJHJI6DAsdZ8YUgToCYImmuM9wiZrUIRw8v8HkuGvF86KE0q jPFv3NSRDYquteS0Szfxqr+ypkHfUOOo0Zn0Kg2RiMvY0SAgE7wf50Fb2AH0Ld4S W0tmOEWjwNT389sFIHLibd5ror99LVATwyuCdmjWL5FXjm6ySqO8x+UJ/2SQk6i5 tGsA8gV2TwCWptnIbWW9pvd89jDrLaKDeDz1sUe6U7bVbHkZUkjBOGYY18UdhvpF baNtFiDO0ao6Ef8rgCYZ6WZKrQuh8cXZsPusDcHjg1j4pQYr5IYbtyUp1C5PRSY+ MVDnEUXyfSEgG4IVY6LpqFPgF/uPOL1iHOc67KFu0+HOxS8EMnoOGSj4zA6c/HuI SoWjLfYBuNrSLGGCkU7jm72G2CB2uhhM6th3vlYtZdZDh2N0uaybDiHF5rUTSQdF zyg6ZQp8woinHf0Sk7JRXWr8UctTpAi1X23Is2S9U6kLKPVvAljIj2tSmzYeUwif mZxYxyBqhvKYKSQNk8cxuFx5eS+IDAWAS4arHlHbrz22S8wsOeA= =QuO5 -----END PGP SIGNATURE----- --=-=-=--