We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d21fe3a commit 6ac7efeCopy full SHA for 6ac7efe
tests/dune
@@ -7,3 +7,8 @@
7
(name test_simple)
8
(modules test_simple)
9
(libraries dscheck))
10
+
11
+(executable
12
+ (name test_spinlock)
13
+ (modules test_spinlock)
14
+ (libraries dscheck))
tests/test_spinlock.ml
@@ -0,0 +1,10 @@
1
+module Atomic = Dscheck.TracedAtomic
2
3
+let test () =
4
+ let lock = Atomic.make true in
5
+ let result = Atomic.make 0 in
6
+ Atomic.spawn (fun () -> while Atomic.get lock do Atomic.incr result done) ;
+ Atomic.spawn (fun () -> Atomic.set lock false) ;
+ Atomic.final (fun () -> Atomic.check (fun () -> Atomic.get result < 10))
+let () = Atomic.trace test
0 commit comments