aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/concurrency/semaphore.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/semaphore.lux')
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux22
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index e26c1a0f2..6b382f6de 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -29,7 +29,7 @@
Test
(_.with-cover [/.Semaphore]
($_ _.and
- (do random.monad
+ (do {@ random.monad}
[initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial-open-positions)]]
(wrap (do promise.monad
@@ -41,10 +41,10 @@
#.None
false)))))
- (do random.monad
+ (do {@ random.monad}
[initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial-open-positions)]]
- (wrap (do promise.monad
+ (wrap (do {@ promise.monad}
[_ (monad.map @ /.wait (list.repeat initial-open-positions semaphore))
result (promise.time-out 10 (/.wait semaphore))]
(_.claim [/.wait]
@@ -54,10 +54,10 @@
#.None
true)))))
- (do random.monad
+ (do {@ random.monad}
[initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial-open-positions)]]
- (wrap (do promise.monad
+ (wrap (do {@ promise.monad}
[_ (monad.map @ /.wait (list.repeat initial-open-positions semaphore))
#let [block (/.wait semaphore)]
result/0 (promise.time-out 10 block)
@@ -70,7 +70,7 @@
_
false)))))
- (do random.monad
+ (do {@ random.monad}
[initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial-open-positions)]]
(wrap (do promise.monad
@@ -88,7 +88,7 @@
Test
(_.with-cover [/.Mutex]
($_ _.and
- (do random.monad
+ (do {@ random.monad}
[repetitions (|> random.nat (:: @ map (|>> (n.% 100) (n.max 10))))
#let [resource (atom.atom "")
expected-As (text.join-with "" (list.repeat repetitions "A"))
@@ -97,7 +97,7 @@
processA (<| (/.synchronize mutex)
io.io
promise.future
- (do io.monad
+ (do {@ io.monad}
[_ (<| (monad.seq @)
(list.repeat repetitions)
(atom.update (|>> (format "A")) resource))]
@@ -105,7 +105,7 @@
processB (<| (/.synchronize mutex)
io.io
promise.future
- (do io.monad
+ (do {@ io.monad}
[_ (<| (monad.seq @)
(list.repeat repetitions)
(atom.update (|>> (format "B")) resource))]
@@ -142,11 +142,11 @@
[_ (#.Some limit)]
(and (n.> 0 raw)
(n.= raw (refinement.un-refine limit))))))
- (do random.monad
+ (do {@ random.monad}
[limit (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1))))
#let [barrier (/.barrier (maybe.assume (/.limit limit)))
resource (atom.atom "")]]
- (wrap (do promise.monad
+ (wrap (do {@ promise.monad}
[#let [ending (|> "_"
(list.repeat limit)
(text.join-with ""))