-
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.
- Loading branch information
1 parent
8a518dd
commit 813a8cb
Showing
6 changed files
with
265 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
profile = default | ||
version = 0.24.1 | ||
version = 0.25.1 |
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
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
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
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,16 @@ | ||
module Atomic = Dscheck.TracedAtomic | ||
|
||
let counter () = | ||
let a = Atomic.make 0 in | ||
let b = Atomic.make 0 in | ||
Atomic.spawn (fun () -> | ||
Atomic.set a 1; | ||
Atomic.set b 2); | ||
Atomic.spawn (fun () -> | ||
Atomic.set a 3; | ||
Atomic.set b 4); | ||
Atomic.final (fun () -> | ||
Printf.printf "a=%d, b=%d\n%!" (Atomic.get a) (Atomic.get b)) | ||
|
||
let test_safe_counter () = Atomic.trace counter | ||
let _ = test_safe_counter () |
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,19 @@ | ||
module Atomic = Dscheck.TracedAtomic | ||
|
||
let test () = | ||
let c = Atomic.make 0 in | ||
let b = Atomic.make 0 in | ||
let ok = Atomic.make false in | ||
|
||
Atomic.spawn (fun () -> Atomic.set b 1); | ||
Atomic.spawn (fun () -> | ||
Atomic.set c 1; | ||
Atomic.set b 2); | ||
Atomic.spawn (fun () -> | ||
if Atomic.get c = 0 then if Atomic.get b = 0 then Atomic.set ok true); | ||
|
||
Atomic.final (fun () -> | ||
Format.printf "b=%i c=%i ok=%b@." (Atomic.get b) (Atomic.get c) | ||
(Atomic.get ok)) | ||
|
||
let () = Atomic.trace test |