summaryrefslogtreecommitdiff
path: root/stdlib/gc.mli
diff options
context:
space:
mode:
authorJun FURUSE / 古瀬 淳 <jun.furuse@gmail.com>2004-06-18 05:04:14 +0000
committerJun FURUSE / 古瀬 淳 <jun.furuse@gmail.com>2004-06-18 05:04:14 +0000
commit5e1bf20850aaa9b1ceb86a971848609ee9e84c47 (patch)
treef3a6e5b5c38263fe527e6275ff95425f12637226 /stdlib/gc.mli
parent8ec769214e067da9ee8b33d05f4ef275e9269dd5 (diff)
downloadocaml-gcaml.tar.gz
port to the latest ocaml (2004/06/18)gcaml
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gcaml@6419 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/gc.mli')
-rw-r--r--stdlib/gc.mli23
1 files changed, 14 insertions, 9 deletions
diff --git a/stdlib/gc.mli b/stdlib/gc.mli
index 491faab393..bafa8ed9f7 100644
--- a/stdlib/gc.mli
+++ b/stdlib/gc.mli
@@ -188,14 +188,15 @@ val finalise : ('a -> unit) -> 'a -> unit
be registered for the same value, or even several instances of the
same function. Each instance will be called once (or never,
if the program terminates before [v] becomes unreachable).
-
-
- A number of pitfalls are associated with finalised values:
- finalisation functions are called asynchronously, sometimes
- even during the execution of other finalisation functions.
- In a multithreaded program, finalisation functions are called
- from any thread, thus they must not acquire any mutex.
+ The GC will call the finalisation functions in the order of
+ deallocation. When several values become unreachable at the
+ same time (i.e. during the same GC cycle), the finalisation
+ functions will be called in the reverse order of the corresponding
+ calls to [finalise]. If [finalise] is called in the same order
+ as the values are allocated, that means each value is finalised
+ before the values it depends upon. Of course, this becomes
+ false if additional dependencies are introduced by assignments.
Anything reachable from the closure of finalisation functions
is considered reachable, so the following code will not work
@@ -232,10 +233,14 @@ val finalise : ('a -> unit) -> 'a -> unit
The results of calling {!String.make}, {!String.create},
{!Array.make}, and {!Pervasives.ref} are guaranteed to be
- heap-allocated and non-constant
- except when the length argument is [0].
+ heap-allocated and non-constant except when the length argument is [0].
*)
+val finalise_release : unit -> unit;;
+(** A finalisation function may call [finalise_release] to tell the
+ GC that it can launch the next finalisation function without waiting
+ for the current one to return. *)
+
type alarm
(** An alarm is a piece of data that calls a user function at the end of
each major GC cycle. The following functions are provided to create