diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1996-10-09 11:14:50 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1996-10-09 11:14:50 +0000 |
commit | e4f0480a473cc9b9a801c86d0478f34b32226c5f (patch) | |
tree | 875177c2750450c5189f7a934854e7536e8eb39e | |
parent | e684a4495265635ec5d5d65a53cf87197acdf5a6 (diff) |
Ajout de do_at_exit
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1068 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | otherlibs/systhreads/pervasives.ml | 10 | ||||
-rw-r--r-- | otherlibs/threads/pervasives.ml | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/otherlibs/systhreads/pervasives.ml b/otherlibs/systhreads/pervasives.ml index 7ab2103a8..404db9ca5 100644 --- a/otherlibs/systhreads/pervasives.ml +++ b/otherlibs/systhreads/pervasives.ml @@ -362,10 +362,12 @@ external sys_exit : int -> 'a = "sys_exit" let exit_function = ref (fun () -> flush stdout; flush stderr) -let exit retcode = - (!exit_function)(); - sys_exit retcode - let at_exit f = let g = !exit_function in exit_function := (fun () -> f(); g()) + +let do_at_exit () = (!exit_function) () + +let exit retcode = + do_at_exit (); + sys_exit retcode diff --git a/otherlibs/threads/pervasives.ml b/otherlibs/threads/pervasives.ml index 71a743f83..7dfcdd4fd 100644 --- a/otherlibs/threads/pervasives.ml +++ b/otherlibs/threads/pervasives.ml @@ -372,10 +372,12 @@ external sys_exit : int -> 'a = "sys_exit" let exit_function = ref (fun () -> flush stdout; flush stderr) -let exit retcode = - (!exit_function)(); - sys_exit retcode - let at_exit f = let g = !exit_function in exit_function := (fun () -> f(); g()) + +let do_at_exit () = (!exit_function) () + +let exit retcode = + do_at_exit (); + sys_exit retcode |