sync et tail-recursion

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3261 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2000-07-28 12:23:53 +00:00
parent eb924a201f
commit 169d14212b
2 changed files with 20 additions and 10 deletions

View File

@ -89,11 +89,16 @@ let basic_sync abort_env genev =
end;
Mutex.unlock masterlock;
(* Extract the result *)
let num = !performed in
let result = bev.(!performed).result() in
(* Handle the aborts and return the result *)
do_aborts abort_env genev num;
result
if abort_env = [] then
(* Preserve tail recursion *)
bev.(!performed).result()
else begin
let num = !performed in
let result = bev.(num).result() in
(* Handle the aborts and return the result *)
do_aborts abort_env genev num;
result
end
(* Apply a random permutation on an array *)

View File

@ -89,11 +89,16 @@ let basic_sync abort_env genev =
end;
Mutex.unlock masterlock;
(* Extract the result *)
let num = !performed in
let result = bev.(!performed).result() in
(* Handle the aborts and return the result *)
do_aborts abort_env genev num;
result
if abort_env = [] then
(* Preserve tail recursion *)
bev.(!performed).result()
else begin
let num = !performed in
let result = bev.(num).result() in
(* Handle the aborts and return the result *)
do_aborts abort_env genev num;
result
end
(* Apply a random permutation on an array *)