caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] "noalloc" + enter/leave blocking section - safe?
@ 2004-08-02 10:43 Markus Mottl
  2004-08-02 15:15 ` Markus Mottl
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Mottl @ 2004-08-02 10:43 UTC (permalink / raw)
  To: OCaml

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-02 16:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-02 10:43 [Caml-list] "noalloc" + enter/leave blocking section - safe? Markus Mottl
2004-08-02 15:15 ` Markus Mottl
2004-08-02 15:34   ` Jere Sanisalo
2004-08-02 15:49     ` Falk Hueffner
2004-08-02 16:02       ` Richard Jones
2004-08-02 16:32       ` Markus Mottl
2004-08-02 16:39         ` Falk Hueffner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).