From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p61FfYP8009804 for ; Fri, 1 Jul 2011 17:41:38 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnICAL3pDU7RVdivkGdsb2JhbAA8AQMSp1sIFAEBAQEJCQ0HFAQhiHmjC4wkgkuEPTmIaAIDBoYsBIc4inqMHjyDXA X-IronPort-AV: E=Sophos;i="4.65,458,1304287200"; d="scan'208";a="86441014" Received: from mail-qy0-f175.google.com ([209.85.216.175]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 01 Jul 2011 17:41:37 +0200 Received: by qyk30 with SMTP id 30so5763qyk.6 for ; Fri, 01 Jul 2011 08:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6Ef2FIdNnsvvo1JRG7nh9boeUBAUTdW1E7h/yHXbgaU=; b=HNufSiDF24a85tt1UiiQLcuaOI+S97/GQ1R55IzYfBZKYq8O1R8+9cKf/wpN+uuSTY TMNcNj6KDqlOkakqEHebYvkLcWVlmOkx0matmvltgJlqdWvW3eEkyCDJ5yWDUpcZGAdU K4fzqZR2/jnaXDlyhqUw+eZQRHXggv8bpCHu8= MIME-Version: 1.0 Received: by 10.229.86.72 with SMTP id r8mr2308971qcl.84.1309534896018; Fri, 01 Jul 2011 08:41:36 -0700 (PDT) Received: by 10.229.249.206 with HTTP; Fri, 1 Jul 2011 08:41:35 -0700 (PDT) In-Reply-To: <4E0DE317.1010002@inria.fr> References: <4E0DB5DE.8090309@inria.fr> <4E0DCD7C.5010907@inria.fr> <801099288.1616121.1309531501115.JavaMail.root@zmbs4.inria.fr> <4E0DE317.1010002@inria.fr> Date: Fri, 1 Jul 2011 19:41:35 +0400 Message-ID: From: Dmitry Bely To: Fabrice Le Fessant Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] GC interface question On Fri, Jul 1, 2011 at 7:09 PM, Fabrice Le Fessant wrote: > On 07/01/2011 04:45 PM, Dmitry Bely wrote: >>> Initialization to 0 for _varg is OK, of course. > > Is it the reply to your former question ? Yes, thanks. >> Yes, that's my modification. Original camlidl is not thread-safe. >> Basically camlidl_acquire_runtime does caml_c_thread_register and >> caml_leave_blocking_section. camlidl_release_runtime points to >> caml_enter_blocking_section. > > If I understand your code, you release the master lock on the GC, No. > and then you call camlidl_alloc_small(). Shouldn't you hold the master lock > while allocating ? Of course. This function is called from C when no Ocaml code is running and the Ocaml master lock is released. So I acquire it on enter (camlidl_acquire_runtime), call an Ocaml callback and release on return (camlidl_release_runtime). - Dmitry Bely