diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2010-05-12 14:32:23 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2010-05-12 14:32:23 +0000 |
commit | 29224ccbe68f7c9c0ff3bfec7b1516607f3dd720 (patch) | |
tree | 57cdcadf40152b5acf49dd24032a90b8c947f833 | |
parent | 7c5ae7af4c4fa0573a6b25507afb428b6fa3f2d8 (diff) |
PR#4742: finalisation function raising an exception blocks other finalisations
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10393 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | Changes | 7 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | byterun/finalise.c | 4 | ||||
-rw-r--r-- | stdlib/gc.mli | 3 |
4 files changed, 13 insertions, 3 deletions
@@ -81,11 +81,18 @@ Standard library: * Random: changed the algorithm to produce better randomness. Now passes the DieHard tests. +Ocamlbuild: +- Add support for native dynlink. + Bug Fixes: - PR#4775: compiler crash on crazy types (temporary fix) +- PR#4970: better error message for instance variables +- PR#4988: contravariance lost with ocamlc -i - PR#5004: problem in Buffer.add_channel with very large lengths. - PR#5008: on AMD64/MSVC port, rare float corruption during GC. - PR#5018: wrong exception raised by Dynlink.loadfile. +- Wrong type for Obj.add_offset. +- Small problem with the representation of Int32, Int64, and Nativeint constants. Objective Caml 3.11.2: ---------------------- @@ -1,4 +1,4 @@ -3.12.0+dev22 (2010-05-05) +3.12.0+dev23 (2010-05-12) # The version string is the first line of this file. # It must be in the format described in stdlib/sys.mli diff --git a/byterun/finalise.c b/byterun/finalise.c index 685155810..bc7996d55 100644 --- a/byterun/finalise.c +++ b/byterun/finalise.c @@ -122,6 +122,7 @@ static int running_finalisation_function = 0; void caml_final_do_calls (void) { struct final f; + value res; if (running_finalisation_function) return; @@ -139,8 +140,9 @@ void caml_final_do_calls (void) -- to_do_hd->size; f = to_do_hd->item[to_do_hd->size]; running_finalisation_function = 1; - caml_callback (f.fun, f.val + f.offset); /* FIXME PR#4742 */ + res = caml_callback_exn (f.fun, f.val + f.offset); running_finalisation_function = 0; + if (Is_exception_result (res)) caml_raise (Extract_exception (res)); } caml_gc_message (0x80, "Done calling finalisation functions.\n", 0); } diff --git a/stdlib/gc.mli b/stdlib/gc.mli index 76fb937e4..b02b758c5 100644 --- a/stdlib/gc.mli +++ b/stdlib/gc.mli @@ -224,7 +224,8 @@ val finalise : ('a -> unit) -> 'a -> unit The [f] function can use all features of O'Caml, including assignments that make the value reachable again. It can also loop forever (in this case, the other - finalisation functions will be called during the execution of f). + finalisation functions will not be called during the execution of f, + unless it calls [finalise_release]). It can call [finalise] on [v] or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when |