summaryrefslogtreecommitdiff
path: root/testsuite/tests/c-api/test_c_thread_has_lock_systhread.ml
blob: ac043c5e925876e70454be0f32a2274296111878 (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
(* TEST
 modules = "test_c_thread_has_lock_cstubs.c";
 include systhreads;
 hassysthreads;
 {
   bytecode;
 }{
   native;
 }
*)

external test_with_lock : unit -> bool = "with_lock"
external test_without_lock : unit -> bool = "without_lock"

let passed b = Printf.printf (if b then "passed\n" else "failed\n")

let f () =
  passed (not (test_without_lock ())) ;
  passed (test_with_lock ())

let _ =
  f ();
  let t = Thread.create f () in
  Thread.join t