From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id DFC2E7ED7A for ; Mon, 27 Aug 2012 21:41:49 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of andre@digirati.com.br) identity=pra; client-ip=187.73.32.187; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="andre@digirati.com.br"; x-sender="andre@digirati.com.br"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of andre@digirati.com.br designates 187.73.32.187 as permitted sender) identity=mailfrom; client-ip=187.73.32.187; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="andre@digirati.com.br"; x-sender="andre@digirati.com.br"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of postmaster@mta115.f1.k8.com.br designates 187.73.32.187 as permitted sender) identity=helo; client-ip=187.73.32.187; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="andre@digirati.com.br"; x-sender="postmaster@mta115.f1.k8.com.br"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsCAILMO1C7SSC7nGdsb2JhbABFhgOzbwQEgQIiAQEBAQEICwkJFCeCSh0BATg0AiYCIg0BOyKHdKZ2boNCAQWPNAaBIY0kggqBEps0YIxW X-IronPort-AV: E=Sophos;i="4.80,322,1344204000"; d="scan'208";a="170975927" Received: from mta115.f1.k8.com.br ([187.73.32.187]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 27 Aug 2012 21:41:48 +0200 Received: from localhost (localhost [127.0.0.1]) by smtpz.f1.k8.com.br (Postfix) with ESMTP id 3C5BC60123 for ; Mon, 27 Aug 2012 19:41:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at k8.com.br Received: from smtpz.f1.k8.com.br ([127.0.0.1]) by localhost (mta115.f1.k8.com.br [127.0.0.1]) (amavisd-new, port 10024) with LMTP id a2cRze6MxUqL for ; Mon, 27 Aug 2012 19:41:44 +0000 (UTC) Received: from [10.7.5.14] (fosforo.f2.k8.com.br [200.150.156.10]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtpz.f1.k8.com.br (Postfix) with ESMTPSA id 0F3C5600DE for ; Mon, 27 Aug 2012 19:41:43 +0000 (UTC) X-DKIM: OpenDKIM Filter v2.5.2 smtpz.f1.k8.com.br 0F3C5600DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digirati.com.br; s=default; t=1346096504; bh=xp90BR0s3DxyynFASVnDJywEswz+oEAJuiAvxG+hvNY=; h=Subject:From:To:Date; b=f/B0AnQD1cg2d7UTbuNuCkg5nAEKV2jYj13Igta4+1aIdFncy5piAQNBLtceWvNS3 /InlE+sdV9g7esNsiJBnPMus72kmjTj0GH/rDMPvqo11hLHiatHN2gxhnE7oKgbRpX L9dyk5CznD0NBC7erE9J+zpX5ZSmOrZMqPakUlm4= Message-ID: <1346096503.4319.5.camel@andre> From: Andre Nathan To: caml-list@inria.fr Date: Mon, 27 Aug 2012 16:41:43 -0300 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Subject: [Caml-list] Thread-private data in C stubs Hello I'm writing stubs to a C library uses pthreads and exposes two functions to get and set thread-private data, getpriv(ctx) and setpriv(ctx, p) where ctx is some opaque context object, and p is a void* pointer. What's the best way to deal with this from the stub code, ie., how do I avoid the thread-private data to be garbage collected when the OCaml variable goes out of scope? Since the library in question uses threads internally, this needs to be a thread-safe solution. Thanks in advance, Andre