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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 2858E7EF10 for ; Mon, 9 Mar 2015 10:21:41 +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.46; 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.46 as permitted sender) identity=mailfrom; client-ip=209.85.192.46; 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-f46.google.com) identity=helo; client-ip=209.85.192.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="masateru.k@gmail.com"; x-sender="postmaster@mail-qg0-f46.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CHAAD4ZP1UlC7AVdFagkOBFVoEsliNf4FwAQmFcAKBIQdNAQEBAQEBEAEBAQEHCwsJEjCEDwEBAQMBAQIPLgEbEgsBAwELBgULAwoNISIBEQEFAQoSBhMSCAiHeAEDCQgNm0E+MY0bgneQMAoZJwMKVIRgAQEBAQEBBAEBAQEBARYBBQ6LCYRqBAeCLU2BMwWEcAqFboMlhWaCGoNVgRo5gm+CVIkcgXgSI4EVhCAvMQGCQgEBAQ X-IPAS-Result: A0CHAAD4ZP1UlC7AVdFagkOBFVoEsliNf4FwAQmFcAKBIQdNAQEBAQEBEAEBAQEHCwsJEjCEDwEBAQMBAQIPLgEbEgsBAwELBgULAwoNISIBEQEFAQoSBhMSCAiHeAEDCQgNm0E+MY0bgneQMAoZJwMKVIRgAQEBAQEBBAEBAQEBARYBBQ6LCYRqBAeCLU2BMwWEcAqFboMlhWaCGoNVgRo5gm+CVIkcgXgSI4EVhCAvMQGCQgEBAQ X-IronPort-AV: E=Sophos;i="5.11,366,1422918000"; d="scan'208";a="102573724" Received: from mail-qg0-f46.google.com ([209.85.192.46]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 09 Mar 2015 10:21:40 +0100 Received: by qgfi50 with SMTP id i50so26756674qgf.9 for ; Mon, 09 Mar 2015 02:21:39 -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 :cc:content-type; bh=4qv7HYWHo78GYzQUZOwAU7U+mQeXMibu11BHT1abZ2A=; b=AZcEN21K95oAz6+GBhuIzCXLDivv4L4EsVs4ggdP2grA8X1LiW1wQzO6Lu2lWpSiLl ILXeuo4KYuITTqg3p98q6CN/55ETdi3K+916wpDUKD1dQM6QgBg5wTkZ4H3qZZim7Sk5 4lOauyR0/qzyljKrMUtkVtGZzOZOluO2lX+GLxhNiyZyNMKHVR9g6Z+pEpgF0qbraNqc LppQmgZtmaLNEzvtscJ0hhsWc4EOGz+SwHMGzpZYcp6epFORvRfyEG6unjz9yV3LeDjE axdfViVFUOG4Ud6o0VzIDIhp15/MRUk3mfsCfO9g0WfyV0iNAPUXW+P03PEQcamy1keC tysA== X-Received: by 10.55.41.80 with SMTP id p77mr21678042qkh.67.1425892899021; Mon, 09 Mar 2015 02:21:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.98.118 with HTTP; Mon, 9 Mar 2015 02:21:08 -0700 (PDT) In-Reply-To: References: From: Masateru Kawaguchi Date: Mon, 9 Mar 2015 18:21:08 +0900 Message-ID: To: David Allsopp Cc: "OCaml List (caml-list@inria.fr)" Content-Type: multipart/alternative; boundary=001a1147b52abbfcf40510d78f24 Subject: Re: [Caml-list] C function calls OCaml function in multithreads --001a1147b52abbfcf40510d78f24 Content-Type: text/plain; charset=ISO-8859-1 > Chapter 19 of the manual? Especially sections 10 "Advanced topics: multithreading" ( http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec465) and 7 "Advanced topics: callbacks from C to OCaml" ( http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec448 - see in particular 19.7.4) Thank you for your answer. I've read the manual. That's what I'd like to know. Best regards, Masateru Kawaguchi 2015-03-09 16:36 GMT+09:00 David Allsopp : > Masateru Kawaguchi wrote: > > 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. > > Chapter 19 of the manual? Especially sections 10 "Advanced topics: > multithreading" ( > http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec465) and 7 > "Advanced topics: callbacks from C to OCaml" ( > http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec448 - see in > particular 19.7.4) > > > David > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs --001a1147b52abbfcf40510d78f24 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
>=A0Chapter 19 of the ma= nual? Especially sections 10 "Advanced topics: multithreading" (<= /span>http://caml.inria.fr/pub/doc= s/manual-ocaml/intfc.html#sec465) and 7 = "Advanced topics: callbacks from C to OCaml" (http://caml.inria.fr/pub/docs/manual-ocaml/int= fc.html#sec448=A0- see in particular 19.= 7.4)

Thank you for your answer.
I've read the manual. That's what I'd = like to know.

Best regards,
Masateru Kawaguchi


<= div class=3D"gmail_quote">2015-03-09 16:36 GMT+09:00 David Allsopp <d= ra-news@metastack.com>:
Mas= ateru Kawaguchi wrote:
> I sent a question to caml-list a few days ago, but there is no reply y= et.
> 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 calle= d by multithread.
> In order to avoid two threads running the OCaml part at one time, I= 9;ll try insert
> a code to acquire mutex lock in the C function before calling the OCam= l 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.

Chapter 19 of the manual? Especially sections 10 "Advanced topics: mul= tithreading" (http://caml.inria.fr/pub/docs/manual-oca= ml/intfc.html#sec465) and 7 "Advanced topics: callbacks from C to = OCaml" (http://caml.inria.fr/pub/docs/manual-ocaml/int= fc.html#sec448 - see in particular 19.7.4)


David


--
Caml-list mailing list.=A0 Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
<= br>
--001a1147b52abbfcf40510d78f24--