summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/testsuite/tests/lib-threads/close.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml-binary-annot/testsuite/tests/lib-threads/close.ml')
-rw-r--r--ocaml-binary-annot/testsuite/tests/lib-threads/close.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/ocaml-binary-annot/testsuite/tests/lib-threads/close.ml b/ocaml-binary-annot/testsuite/tests/lib-threads/close.ml
new file mode 100644
index 0000000000..7bda242600
--- /dev/null
+++ b/ocaml-binary-annot/testsuite/tests/lib-threads/close.ml
@@ -0,0 +1,15 @@
+let main () =
+ let (rd, wr) = Unix.pipe() in
+ let _ = Thread.create
+ (fun () ->
+ ignore (Unix.write wr "0123456789" 0 10);
+ Thread.delay 3.0;
+ print_endline "closing fd...";
+ Unix.close rd)
+ () in
+ let buf = String.create 10 in
+ print_endline "reading...";
+ ignore (Unix.read rd buf 0 10);
+ print_endline "read returned"
+
+let _ = Unix.handle_unix_error main ()