blob: 1f0f57a1836ae7bbeea329abe37866283b89bfbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
(* TEST
include unix;
hasunix;
not-windows;
{
bytecode;
}{
native;
}
*)
(* on Multicore, fork is not allowed is another domain is, and was running. *)
(* this test checks that we can't fork if a domain is currently running. *)
let expect_exn ="Unix.fork may not be called while other domains were created"
let () =
let d = Domain.spawn (fun () -> Unix.sleep 1) in
begin match Unix.fork () with
| exception Failure msg ->
if String.equal msg expect_exn then
print_endline "OK"
else
Printf.printf "failed: expected Failure: %s, got %s\n" expect_exn msg
| _ -> print_endline "NOK"
end;
Domain.join d
|