summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-systhreads/multicore_lifecycle.ml
blob: f48146490696cac128dbd2634e31cc55b6e74717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(* TEST
* hassysthreads
include systhreads
** bytecode
** native
*)

let _ =
  let t = ref (Thread.self ()) in
  let d = Domain.spawn begin fun () ->
     let thread_func () = Unix.sleep 5 in
     let tt = Thread.create thread_func () in
     t := tt;
    ()
   end
  in
  Domain.join d;
  Thread.join (!t);
  Domain.join @@ Domain.spawn (fun () -> print_endline "ok")