mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-09 20:55:31 -05:00
test for #94 (using Thread.yield to trigger segfault)
This commit is contained in:
parent
5e7cfed9b8
commit
126bb2f3f2
1 changed files with 4 additions and 4 deletions
|
|
@ -68,10 +68,10 @@ let with_acquire ~n t ~f =
|
||||||
let a = Array.init 100 (fun i ->
|
let a = Array.init 100 (fun i ->
|
||||||
Thread.create (fun _ ->
|
Thread.create (fun _ ->
|
||||||
for _i = 1 to 100 do
|
for _i = 1 to 100 do
|
||||||
with_acquire ~n:(1 + (i mod 5)) s
|
with_acquire ~n:(1 + (i mod 5)) s
|
||||||
~f:(fun () -> CCLock.incr n)
|
~f:(fun () -> Thread.yield(); CCLock.incr n)
|
||||||
done
|
done)
|
||||||
) ())
|
())
|
||||||
in
|
in
|
||||||
Array.iter Thread.join a;
|
Array.iter Thread.join a;
|
||||||
assert_equal ~printer:CCInt.to_string 5 (get s);
|
assert_equal ~printer:CCInt.to_string 5 (get s);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue