From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA29586; Mon, 2 Aug 2004 12:43:52 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA28575 for ; Mon, 2 Aug 2004 12:43:51 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i72AhoEV025512 for ; Mon, 2 Aug 2004 12:43:50 +0200 Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i72AhnDu008423 for ; Mon, 2 Aug 2004 12:43:49 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i72AhnO1008422 for caml-list@inria.fr; Mon, 2 Aug 2004 12:43:49 +0200 Date: Mon, 2 Aug 2004 12:43:49 +0200 From: Markus Mottl To: OCaml Subject: [Caml-list] "noalloc" + enter/leave blocking section - safe? Message-ID: <20040802104349.GA6997@fichte.ai.univie.ac.at> Mail-Followup-To: OCaml Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 410E1AE6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; noalloc:01 noalloc:01 implemented:01 camlprim:01 val:01 bug:01 ocaml-heap:01 caml:01 caml:01 blocking:01 blocking:01 synchronize:01 filesystem:02 mottl:02 mottl:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, one important question: is it safe to use "noalloc" with C-functions that contain calls to "caml_enter_blocking_section" and "caml_leave_blocking_section" to allow other POSIX-treads? I have the following external function: (** Synchronize all filesystem buffers with disk. *) external sync : unit -> unit = "unix_sync" "noalloc" It is implemented as follows: CAMLprim value unix_sync() { caml_enter_blocking_section(); sync(); caml_leave_blocking_section(); return Val_unit; } When removing the "noalloc" attribute, I cannot reproduce the problem (crash) reported in bug report #3019 anymore, but I'm not sure whether this is just a coincidence. Of course, functions with this attribute shouldn't allocate anything on the OCaml-heap or throw exceptions. But I thought that context-switches would be safe? Best regards, Markus -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners