From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 530EC7F164 for ; Mon, 7 Mar 2016 04:00:58 +0100 (CET) IronPort-PHdr: 9a23:3uVMWRbn6VpIDonMiZNSwtP/LSx+4OfEezUN459isYplN5qZpcS/bnLW6fgltlLVR4KTs6sC0LqJ9fC4EjFaqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7/0q8WYPl8ArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIZoGJ/3dKUgTLFeEC9ucyVsvJWq5lH/Sl6o7XIZVi0zmxtMAg7KpDX7RYu55iDzs+443CiBIeX3S6o1UHKs9fE4ZgXvjXIoMCUm8WeflMt2xIhBrR6svRh43MaAb4aOK/t4O72Yd/sFSGAHUssHBH8JOZ+1c4ZaV7lJBu1ftYSo4gJW9RY= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=goswin-v-b@web.de; spf=Pass smtp.mailfrom=goswin-v-b@web.de; spf=None smtp.helo=postmaster@mout.web.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.15.4; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of goswin-v-b@web.de designates 212.227.15.4 as permitted sender) identity=mailfrom; client-ip=212.227.15.4; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.15.4; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ARAQB07txWlgQP49RdrTMEA4ohh2qBaYYKA4EkOhIBAQEBAQEBARABAQEBBw0JCSEvQQ4BgV2CVXsUIAUoIYgfARUEoHqZEx+FKZI5gQ8FlyqBI4xAgW2HOAonhS6OVScGgkkcgTWIIEskgRcBAQE X-IPAS-Result: A0ARAQB07txWlgQP49RdrTMEA4ohh2qBaYYKA4EkOhIBAQEBAQEBARABAQEBBw0JCSEvQQ4BgV2CVXsUIAUoIYgfARUEoHqZEx+FKZI5gQ8FlyqBI4xAgW2HOAonhS6OVScGgkkcgTWIIEskgRcBAQE X-IronPort-AV: E=Sophos;i="5.22,549,1449529200"; d="scan'208";a="167356301" Received: from mout.web.de ([212.227.15.4]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2016 04:00:57 +0100 Received: from frosties.localnet ([134.3.242.84]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0Ly7vR-1ZpJYT2blF-015cMn for ; Mon, 07 Mar 2016 04:00:56 +0100 Received: from mrvn by frosties.localnet with local (Exim 4.84) (envelope-from ) id 1aclPk-0008LS-4u for caml-list@inria.fr; Mon, 07 Mar 2016 04:00:56 +0100 Date: Mon, 7 Mar 2016 04:00:56 +0100 From: Goswin von Brederlow To: Ocaml Mailing List Message-ID: <20160307030056.GC31098@frosties> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:O0T5SQycGpzJ01aPSUrWY2RJrAKeORhkVfcVRsrGXVLO9acOJFS uJDuU4kqNYBLCBqB0psbzS9w8J4k0XkSsXMyvrJHhknYdG64lYZjADK1QMax2aXY8olVFnb cfRC7g0HPZA/7aoFrku6CxoNQal/e2e0GYYxFF3fBfFVxi57eccwmMq2pLAEPLAykmiltju CJjTOilC0IBKxUDEUmzrg== X-UI-Out-Filterresults: notjunk:1;V01:K0:cRnMCCp1aIs=:4455Ief3UCJwqzErlCeh+j zvQXbXHtxApxi8doDzEzuCGCCuHDCNzJZu8ZfdlndaM01EcE5GtEf+RQrA9gJkmCQI50p3T/y l7oO1RPu306d30yub/blsz7Ed66IsT/P5yhuAnsX4088wpTeV6vy9umN+iYoS3+zHU1Mou1jS R3nRt/OPFO5tOZVNDoWv3sWRiK0mQjQgAfY9fz/UrADCmmd7EVilwv1oMULpZVXjwgDw7LUeI +a9pdTNL04xG95JRDE8wV7nmVDRnmUQCMrGFUMf/Akx8+eOtP+39dxuhPw8PvKvTfw9tLtk+H BOOmJXQFZ0gwkmoYfQlHmJ9cC2SI88ZYaDcj2Urihw+4COEPYkvD4pUoVXdXbPSC+tTjJwFQY Xcn5E14Fpb/gfYPs/OGDyj1SYCyxQHdeMRfqcPDknfRrNjG+vNs+HQiUi7k6Dkx5JRIBgfsDZ 4dmZkQLhrF8eXkU9oM12zT8kqFpjQ+hGi0jp99gbNClS8L/eGQf9TnpS2cXR8ek0LSi02Grbr nRsYi4XwF86cp7G4zaEZ/S/zRgYA4f1/xLw857FHCB4D32RbZ1Ek8Azvle4R2QrMh9Zwats5n qzCzHM6y2rF25MutuHQKOyEvQm9rER7pyT0rl3+KZUVwCcG4kFtQxAJLyOVPBBM6DDiphdTRl voZ8EBOtvNr12UMP/OpuyRQ1PzxaNCTVvOQ5+/nSDxgmbt6beTnajtVf7jrQhRj7M/i1tTpJB /MQ7eiRMB+BzmPKVM6+1rJ0kZ55OeMJNQXDO+/HhSEmHckx0pKGO3dxswjg= Subject: [Caml-list] How to register a struct of values with the GC so they remain accessible without runtime lock? Hi, for my Qt5 bindings I need to keep track of any number of ocaml values for a Qt5 class. I could allocate a block on the ocaml heap to store all those values, store the address of that with the Qt5 class and register it as global root. But then any access would require aquiring the ocaml runtime lock. A bunch of values are closures for optional callbacks, with a value of 0 denoting the callback isn't installed. I would like to at least check values against 0, in which case I can just go back to Qt5 without having to wait for the runtime lock. I imagine having to wait for the ocaml runtime lock would seriously impact the responsiveness of the GUI since a number of callbacks get invoked for any action, like moving the mouse from one widget to another. (Assuming some other ocaml threads are running and stealing the lock inbetween callbacks.) If they are not 0 then I would aquire the runtime lock, read the value again and call the calback. I could do this by registering every single field of the structure as global root separatly. 1) Is that actually save? When moving values the GC will never set a closure value to 0 temporarily, right? 2) Would that be insane? A normal GUI could have thousands of roots then but they would never (rarely) change [could use generational roots]. 3) Is there a better way? MfG Goswin