testsuite: Windows (7) does not reliably stop all threads when a process calls exit(). Update thread test to avoid this problem.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13669 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
5de2108817
commit
4efee60493
|
@ -10,32 +10,22 @@
|
|||
(* *)
|
||||
(***********************************************************************)
|
||||
|
||||
let debug = Printf.eprintf;;
|
||||
|
||||
let main () =
|
||||
debug "starting\n%!";
|
||||
let (rd, wr) = Unix.pipe() in
|
||||
debug "after pipe\n%!";
|
||||
let _ = Thread.create
|
||||
let t = Thread.create
|
||||
(fun () ->
|
||||
debug "sub: starting\n%!";
|
||||
ignore (Unix.write wr "0123456789" 0 10);
|
||||
debug "sub: after write\n%!";
|
||||
Thread.delay 3.0;
|
||||
debug "sub: after delay\n%!";
|
||||
print_endline "closing fd...";
|
||||
Unix.close rd;
|
||||
debug "sub: after close\n%!";
|
||||
)
|
||||
() in
|
||||
debug "after thread.create\n%!";
|
||||
let buf = String.create 10 in
|
||||
debug "after string.create\n%!";
|
||||
print_endline "reading...";
|
||||
ignore (Unix.read rd buf 0 10);
|
||||
debug "after read\n%!";
|
||||
print_endline "read returned"
|
||||
print_endline "read returned";
|
||||
t
|
||||
|
||||
let _ = Unix.handle_unix_error main ()
|
||||
let t = Unix.handle_unix_error main ()
|
||||
|
||||
;;debug "that's all folks\n%!"
|
||||
let _ = Thread.join t
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
reading...
|
||||
read returned
|
||||
closing fd...
|
||||
|
|
Loading…
Reference in New Issue