From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 52ACC7FD1D for ; Wed, 4 Nov 2015 14:19:07 +0100 (CET) IronPort-PHdr: 9a23:C5kSuB2L2BkUp2ensmDT+DRfVm0co7zxezQtwd8ZsegeLvad9pjvdHbS+e9qxAeQG96LtrQf06GK4+jJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6PyZ/vnLzis7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYk7sb+sVBSaT3ebgjBfwdVWx+cjN92Mq+/yPCRguG/HdUbSMz1FJqBA7I91uyCo3wuSvSv+x71TmbNIvxV79iChq46KI+ZxLyhG88Kzk96GTejMo42KNdrhWJqBFlz8vPfIaRLP93eKWbcd5MFjkJZdpYSyEUWtD0VIAIFedUeL8A94Q= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.130; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.130; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.130; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BVAACkBDpWlIJ+49RehA5vvzAXBoV2AoFBPBABAQEBAQEBARABAQEBBwsLCR8wgi6CCAEBBCcuJBALRlcGEwmIKQmwdm+PYQEBAQEBAQQBAQEBARUJhVqFeYRmglUMQYEwBYdEjwSBAgKVNgSTJjiCUoFecQGFMwEBAQ X-IPAS-Result: A0BVAACkBDpWlIJ+49RehA5vvzAXBoV2AoFBPBABAQEBAQEBARABAQEBBwsLCR8wgi6CCAEBBCcuJBALRlcGEwmIKQmwdm+PYQEBAQEBAQQBAQEBARUJhVqFeYRmglUMQYEwBYdEjwSBAgKVNgSTJjiCUoFecQGFMwEBAQ X-IronPort-AV: E=Sophos;i="5.20,243,1444687200"; d="asc'?scan'208";a="186027533" Received: from mout.kundenserver.de ([212.227.126.130]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2015 14:18:59 +0100 Received: from office1.lan.sumadev.de ([178.4.216.3]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0M5L11-1afDTB3t4Z-00zUFC; Wed, 04 Nov 2015 14:18:59 +0100 Received: from [192.168.5.106] (thinkpad.lan.sumadev.de [192.168.5.106]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 2132BDC05D; Wed, 4 Nov 2015 14:18:58 +0100 (CET) Message-ID: <1446643128.3000.11.camel@thinkpad.lan.sumadev.de> From: Gerd Stolpmann To: "Richard W.M. Jones" Cc: caml-list@inria.fr Date: Wed, 04 Nov 2015 14:18:48 +0100 In-Reply-To: <20151104124321.GA25230@annexia.org> References: <20151104124321.GA25230@annexia.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-QkAZSYr0mtKesUW3l9sX" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V03:K0:bbG89NxkYMiKupq/7KsC6IchX76ECal25vrJeLpWkrux5ox0p1K IEXFzARx/um+Vp9gFujJaY3cZDF2hr4vzay5my4vC2enOqzWHGsKQROIXXtvmsxcNGR20Fy x4ZmrriEpkWa2rXL1IFI4BbcHs3dPL0fxAYusC9muSvvAXZyXBOLpeGWCvQnD14IUvK5BFf /oQcwMap/wzuvVwidR/rQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:P7Q8n/MxJUQ=:4l3ya0dZq9o14lXf3PiS3O kOZ8BcveDyI4ZhnDi8QkAKK5DYNPNn5Jr4tScCLYdv+KSGHtcs0P1zTU/GDUfayJd1IiUFg+Q rVX0a6x8NlZFAW91AVzCoyufFNP2tYA+PDvMK1EdL0VIaroZHECKJ1arQOsll+IUbyHnDtWgD AhNQNOBwgAV0v2q90p08olsCaotApkBJO5MaIqbnx1pSyU8QBsfYB+i0OFu7Qg4BE3tXuIzHf zO41szctYPkUF0yzghlBP9cLebKEYEcO1BfO5Se+iNL/S5NF7xxgEci8aEgGApwcu5JFV4ENx v39IA6qza0EIfZzDGfqsQoB0Jcw+moa2t4Z0VCpW7lk5NqM2dIGzjq4JjSZ0zw+uUxtYCV1af L6cYAI8kIrmzILiZ9sIbNbHWeGoyIVrcntL5h4bQdIgnMEBtHCCy3Z7MPvtgOtpJbHzB5Mn7C vNa40mq8WwciTFJ7DA/Uvbsx8DnePd9cbF0vpOGm8XvP/J8jxhuBPIigPbz7ZpLmUId4ciLTb aUj0+nHYzgCdD18BbNnaT3WvQV0TeoXtw+AsuseQ6lpHuSAjCJdlN/LdFrOg5kORuoQMVrsKq D6UpkHW8RT1KUt1DOQgEH8lSOaukW0v9vL4K5/byJgixZDNeatlj6PA5CWggN6cSb8gwuLn5C 3ctPAIKDEU3vXdPTrfCk768YUHLRHMFZ69ERTWrA1E5YxKOLo9BJLYmYuJxMuk1FIMYc= Subject: Re: [Caml-list] Are refs volatile? --=-QkAZSYr0mtKesUW3l9sX Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Mittwoch, den 04.11.2015, 12:43 +0000 schrieb Richard W.M. Jones: > Some code I wrote recently does: >=20 > let quit =3D ref false in > let set_quit _ =3D quit :=3D true in > Sys.set_signal Sys.sigint (Sys.Signal_handle set_quit); > Sys.set_signal Sys.sigquit (Sys.Signal_handle set_quit); >=20 > and later on (where `tasks' is a list of long-running tasks): >=20 > List.iter ( > fun task -> > if not !quit then task (); > ) tasks; >=20 > This works fine. My question is, could a change to the compiler in > future cause the reference to !quit to be optimized away? And if so, > is there a way to mark it as "volatile" (in the C sense)? Interesting question. My guess is that it is much harder to optimize side-effects in the presence of closures, and that it is fairly unlikely that anybody attempts this. In this piece of code, you must be sure that [task] doesn't set [quit], but this ref can be well hidden, and the analysis needed to figure this out seems to be complicated. Gerd --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-QkAZSYr0mtKesUW3l9sX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJWOgW5AAoJEAaM4b9ZLB5Trb0H/RHBpEUiPrD3xV6KeuQAHumB r06RR7mnvdSZ0opIMIo0AHsSXaswG6RkSbVnlp6VZSkD+6emFedQwHc0j39MTCfk UNxVOpFaKyfO/ga0Gr/a7/IPkOsdBZim81WvzbzYZbnQ2518mLsUXm55JwwOcBwU I9psWCHC9uWBqbyZ8nSKCTlFkczPLRaUFegIKyYaW0NukE61l/O2jU3DOiX9A4Fk piqeam9tHOxDhzOR6wgkLdKJvKbXi5TjEloaGcppBafo9DwDS/derUnB4ZR4XupC yyuufjjLZAJMWEJspifSUm6woZ+k7/v/vy/n/UT1XlJ5Av7OGr9MrIbuE/glyD0= =bX7i -----END PGP SIGNATURE----- --=-QkAZSYr0mtKesUW3l9sX--