From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 2BB29BD73 for ; Wed, 17 Aug 2005 06:12:57 +0200 (CEST) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7H4CunX006387 for ; Wed, 17 Aug 2005 06:12:56 +0200 Received: by rproxy.gmail.com with SMTP id a36so91966rnf for ; Tue, 16 Aug 2005 21:12:56 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Xj2q4302+Ss2oEboGxBhTIFrGRDdCKfNMurOJ/N3sCc/Tn8hxqKoutdREHyA1FjYdyqD3ZYqLTdUaoZnZXzKIDXLogcHj8kd2WbmUlQ79t4toop4T7Cpi0wCM5ddhlYiY9Z6KpK+5XXFeFMbSxbFLkXeZEXo9YH+zmwdNcCugLI= Received: by 10.38.209.36 with SMTP id h36mr26423rng; Tue, 16 Aug 2005 21:12:56 -0700 (PDT) Received: by 10.38.209.44 with HTTP; Tue, 16 Aug 2005 21:12:56 -0700 (PDT) Message-ID: Date: Wed, 17 Aug 2005 16:12:56 +1200 From: Jonathan Roewen To: caml-list@yquem.inria.fr Subject: [Caml-list] Stopping a value from getting GC'd Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Miltered: at nez-perce with ID 4302B948.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 gc'd:01 struct:01 struct:01 char:01 stack:01 char:01 pointer:01 typedef:01 val:01 camlparam:01 alloc:01 camlreturn:01 val:01 exception:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 Hi, I have the following in my C code: struct caml_thread_struct { =09char * bottom_of_stack; =09unsigned long last_retaddr; =09value * gc_regs; =09char * exception_pointer; =09struct caml__roots_block * local_roots; =09int is_running; =09value closure; }; typedef struct caml_thread_struct * caml_thread_t; static value Val_thread(caml_thread_t thread) { =09CAMLparam0(); =09CAMLlocal1(rv); =09rv =3D caml_alloc(1, Abstract_tag); =09Field(rv,0) =3D (value) thread; =09CAMLreturn(rv); } #define Thread_val(rv) ((caml_thread_t)Field((rv),0)) Now my question is, since my Thread.t is abstract, once I pass my value to my Thread.create, there'll soon be nothing referencing the closure for the thread that's visible by the GC. If I'm correct, the GC would then be allowed to reclaim this closure. So how do I stop the GC from doing that? Jonathan