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 5495E7EF10 for ; Mon, 9 Mar 2015 02:31:50 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of masateru.k@gmail.com) identity=pra; client-ip=209.85.192.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="masateru.k@gmail.com"; x-sender="masateru.k@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of masateru.k@gmail.com designates 209.85.192.49 as permitted sender) identity=mailfrom; client-ip=209.85.192.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="masateru.k@gmail.com"; x-sender="masateru.k@gmail.com"; 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@mail-qg0-f49.google.com) identity=helo; client-ip=209.85.192.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="masateru.k@gmail.com"; x-sender="postmaster@mail-qg0-f49.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0COAABJ9/xUlDHAVdFahDIEyCQCgRsHTQEBAQEBARABAQEBBwsLCRIwhBABAQMBEi4BGx4DAQsGBQQHOyEBAREBBQEcGSKHeAEDCQibbz4xjRuCd5AmChknDVSEYAELGgEFDosJgkSCMRaEFwWKaIslgg2BSIEagyiJH4RJEiOBFYQgLzGCQwEBAQ X-IPAS-Result: A0COAABJ9/xUlDHAVdFahDIEyCQCgRsHTQEBAQEBARABAQEBBwsLCRIwhBABAQMBEi4BGx4DAQsGBQQHOyEBAREBBQEcGSKHeAEDCQibbz4xjRuCd5AmChknDVSEYAELGgEFDosJgkSCMRaEFwWKaIslgg2BSIEagyiJH4RJEiOBFYQgLzGCQwEBAQ X-IronPort-AV: E=Sophos;i="5.11,364,1422918000"; d="scan'208";a="102540923" Received: from mail-qg0-f49.google.com ([209.85.192.49]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 09 Mar 2015 02:31:49 +0100 Received: by qgfi50 with SMTP id i50so25153740qgf.9 for ; Sun, 08 Mar 2015 18:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=uCF3g66NzhR0at+gEPHL1htL01ol8a4Ce11tcOFb3I8=; b=pMnY0waIS51362w/uj/KKhcZlVxUXoay5kOij0MCFYt24yOPCJqWjwqTjwDlnMPFJU z3WBvSufq8kz4SvTgf1Q5GAASu9UhXE3vnzL5c49m54iqD99FKbdTVyygyG1FMhC+GBC Yqf8TI3tFjWErnfSfTndSjH/WjJUvMR14E0bmrbDCUkF6rQjCixsPKi9sQ6vLI6BEuKs D4mJN00fvHMz8bjjnCyqnHuRMmV7Og042XgQFMb/pZm4p6DrrnEzIcfTfgb8yzHcS9pg airsB3i+izZy11seFvPVy9PJftf7AyNlZthhFngUPcGvduk0Ni3oh/rPPttkARSoqFN4 8+QQ== X-Received: by 10.55.55.15 with SMTP id e15mr50578593qka.21.1425864708210; Sun, 08 Mar 2015 18:31:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.98.118 with HTTP; Sun, 8 Mar 2015 18:31:17 -0700 (PDT) In-Reply-To: References: From: Masateru Kawaguchi Date: Mon, 9 Mar 2015 10:31:17 +0900 Message-ID: To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=001a1146f1ca6e601a0510d0ff57 Subject: Re: [Caml-list] C function calls OCaml function in multithreads --001a1146f1ca6e601a0510d0ff57 Content-Type: text/plain; charset=ISO-8859-1 Hello, I sent a question to caml-list a few days ago, but there is no reply yet. So let me explain my question in detail. I have a C program and I'll try to rewrite some libraries of them in OCaml. The C program runs in multithreads, so the OCaml library will be called by multithread. In order to avoid two threads running the OCaml part at one time, I'll try insert a code to acquire mutex lock in the C function before calling the OCaml function. But I'm not sure that is enough to run the program safely. Does anyone know about it ? Please give me some advise about multithreading or how to incorporate OCaml into C program. Best regards, Masateru Kawaguchi 2015-03-05 11:31 GMT+09:00 Masateru Kawaguchi : > Hello, > > I'm implementing a C function that calls an OCaml function. > > If the C function is called by multithreads, the OCaml function works fine > ? > Is that all right when the C function uses mutual exclusion locks ? > > Best regards, > Masateru Kawaguchi > > --001a1146f1ca6e601a0510d0ff57 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,

I sent a questio= n to caml-list a few days ago, but there is no reply yet.
So let = me explain my question in detail.

I have a C progr= am and I'll try to rewrite some libraries of them in OCaml.
T= he C program runs in multithreads, so the OCaml library will be called by m= ultithread.
In order to avoid two threads running the OCaml part = at one time, I'll try insert
a code to acquire mutex lock in = the C function before calling the OCaml function.
But I'm not= sure that is enough to run the program safely.

Do= es anyone know about it ?
Please give me some advise about multit= hreading or how to incorporate OCaml into C program.

Best regards,
Masateru Kawaguchi

2015-03-05 11:31 GMT+09:= 00 Masateru Kawaguchi <masateru.k@gmail.com>:
Hello,

I'm impl= ementing a C function that calls an OCaml function.

If the C function is called by multithreads, the OCaml function works= fine ?
Is that all right when the C function uses mutual exclusi= on locks ?=A0

Best regards,
Masateru Kaw= aguchi


--001a1146f1ca6e601a0510d0ff57--