summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorValentin Gatien-Baron <valentin.gatienbaron@gmail.com>2017-07-30 10:41:42 -0400
committerValentin Gatien-Baron <valentin.gatienbaron@gmail.com>2017-08-24 22:10:23 -0400
commite26c27e0029250b93684d191f6b4bc0d857198c6 (patch)
tree5a9e8ce0757e2ef84993a6c085e0b00739749498 /stdlib
parentea4e0095330d18dd5af1983bb3a1e3a0d883baff (diff)
downloadocaml-e26c27e0029250b93684d191f6b4bc0d857198c6.tar.gz
Remove 50ms delay at exit for programs using threads
$ cat /tmp/b.ml let () = Thread.join (Thread.create ignore ()) let () = for _ = 0 to 100000; do () done $ ocamlopt -I +threads unix.cmxa threads.cmxa /tmp/b.ml -o b $ time ./b # before this commit real 0m0.053s user 0m0.000s sys 0m0.000s $ time ./b # after this commit real 0m0.003s user 0m0.000s sys 0m0.000s
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/pervasives.mli15
1 files changed, 9 insertions, 6 deletions
diff --git a/stdlib/pervasives.mli b/stdlib/pervasives.mli
index f6a6f1153e..b9e52401a7 100644
--- a/stdlib/pervasives.mli
+++ b/stdlib/pervasives.mli
@@ -1200,12 +1200,15 @@ val exit : int -> 'a
terminates early because of an uncaught exception. *)
val at_exit : (unit -> unit) -> unit
-(** Register the given function to be called at program
- termination time. The functions registered with [at_exit]
- will be called when the program executes {!Pervasives.exit},
- or terminates, either normally or because of an uncaught exception.
- The functions are called in 'last in, first out' order:
- the function most recently added with [at_exit] is called first. *)
+(** Register the given function to be called at program termination
+ time. The functions registered with [at_exit] will be called when
+ the program does any of the following:
+ - executes {!Pervasives.exit}
+ - terminates, either normally or because of an uncaught
+ exception
+ - executes the C function [caml_shutdown].
+ The functions are called in 'last in, first out' order: the
+ function most recently added with [at_exit] is called first. *)
(**/**)