-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
another conditional test back out sleep set override
- Loading branch information
1 parent
858271f
commit 337fc79
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Atomic = Dscheck.TracedAtomic | ||
|
||
let test () = | ||
let x = Atomic.make 0 in | ||
let y = Atomic.make 0 in | ||
let z = Atomic.make 0 in | ||
|
||
let tmp = ref (-1) in | ||
Atomic.spawn (fun () -> tmp := Atomic.get x); | ||
Atomic.spawn (fun () -> Atomic.set y 1); | ||
|
||
Atomic.spawn (fun () -> | ||
let m = Atomic.get y in | ||
if m = 0 then Atomic.set z 1); | ||
|
||
Atomic.spawn (fun () -> | ||
let n = Atomic.get z in | ||
let l = Atomic.get y in | ||
if n = 1 then if l = 0 then Atomic.set x 1); | ||
|
||
Atomic.final (fun () -> | ||
Format.printf "tmp=%d x=%d y=%d z=%d\n%!" !tmp (Atomic.get x) | ||
(Atomic.get y) (Atomic.get z)) | ||
|
||
let () = Atomic.trace test |