Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] "noalloc" + enter/leave blocking section - safe?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: [Caml-list] "noalloc" + enter/leave blocking section - safe?

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()
    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 Mottl

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: