From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5F807BC0B for ; Fri, 8 Dec 2006 11:18:21 +0100 (CET) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kB8AIK17003744 for ; Fri, 8 Dec 2006 11:18:21 +0100 Received: by nf-out-0910.google.com with SMTP id q29so1147882nfc for ; Fri, 08 Dec 2006 02:18:20 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nm6emqdIi/u3ldcMemOg53Ncr5F6LB9zds7gcVgkAwAy8BFTO6VzyyQwBqJXv9ghtCf69Z2qsKNM/Rdm31eRLRwhFdwRkYI/wOHjIh4HGZdJE5IAxyYrix/6hMwHpil6hI3dRdyC+IrUPj+RRfMMJ7h823paDKPO+tby2y4Uh4w= Received: by 10.82.127.15 with SMTP id z15mr481768buc.1165573100401; Fri, 08 Dec 2006 02:18:20 -0800 (PST) Received: by 10.82.138.5 with HTTP; Fri, 8 Dec 2006 02:18:20 -0800 (PST) Message-ID: <53c655920612080218t765e9614j5d16c3b397f6691c@mail.gmail.com> Date: Fri, 8 Dec 2006 11:18:20 +0100 From: "David Baelde" Reply-To: david.baelde@ens-lyon.org To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Creating wrappers for C libraries In-Reply-To: <200612080708.35547.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20061208155437.7ed85c4f.mle+ocaml@mega-nerd.com> <200612080708.35547.jon@ffconsultancy.com> X-j-chkmail-Score: MSGID : 45793BEC.003 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45793BEC.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; wrappers:01 ocaml:01 ocaml:01 threads:01 cheers:01 caml-list:01 functions:01 functions:01 data:02 caml:02 blocking:04 guess:04 problem:05 clue:06 function:08 Hi, One problem with such automated tools is that they have no clue of which C function takes time and which returns almost instantly. And these things matter in OCaml, as soon as you use your wrapper in multithreaded programs: the time-consuming functions should be wrapped around enter/leave_blocking_section() (and the ocaml data copied to places untouched by the Gc) so that other caml threads can run while the function is performed. However, for libsndfile, most functions are very fast, so I guess you can try automatic tools. Cheers. -- David