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.lux28
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 94017a803..40cc7d703 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -42,7 +42,7 @@
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
- [result (async.time_out ..delay (/.wait semaphore))]
+ [result (async.time_out ..delay (/.wait! semaphore))]
(_.cover' [/.semaphore]
(case result
(#.Some _)
@@ -54,9 +54,9 @@
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do {! async.monad}
- [_ (monad.map ! /.wait (list.repeated initial_open_positions semaphore))
- result (async.time_out ..delay (/.wait semaphore))]
- (_.cover' [/.wait]
+ [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore))
+ result (async.time_out ..delay (/.wait! semaphore))]
+ (_.cover' [/.wait!]
(case result
(#.Some _)
false
@@ -67,12 +67,12 @@
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do {! async.monad}
- [_ (monad.map ! /.wait (list.repeated initial_open_positions semaphore))
- .let [block (/.wait semaphore)]
+ [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore))
+ .let [block (/.wait! semaphore)]
result/0 (async.time_out ..delay block)
- open_positions (/.signal semaphore)
+ open_positions (/.signal! semaphore)
result/1 (async.time_out ..delay block)]
- (_.cover' [/.signal]
+ (_.cover' [/.signal!]
(case [result/0 result/1 open_positions]
[#.None (#.Some _) (#try.Success +0)]
true
@@ -83,7 +83,7 @@
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
- [outcome (/.signal semaphore)]
+ [outcome (/.signal! semaphore)]
(_.cover' [/.semaphore_is_maxed_out]
(case outcome
(#try.Failure error)
@@ -103,7 +103,7 @@
expected_As (text.join_with "" (list.repeated repetitions "A"))
expected_Bs (text.join_with "" (list.repeated repetitions "B"))
mutex (/.mutex [])
- processA (<| (/.synchronize mutex)
+ processA (<| (/.synchronize! mutex)
io.io
async.future
(do {! io.monad}
@@ -111,7 +111,7 @@
(list.repeated repetitions)
(atom.update! (|>> (format "A")) resource))]
(in [])))
- processB (<| (/.synchronize mutex)
+ processB (<| (/.synchronize! mutex)
io.io
async.future
(do {! io.monad}
@@ -123,7 +123,7 @@
[_ processA
_ processB
.let [outcome (io.run! (atom.read! resource))]]
- (_.cover' [/.mutex /.synchronize]
+ (_.cover' [/.mutex /.synchronize!]
(or (text\= (format expected_As expected_Bs)
outcome)
(text\= (format expected_Bs expected_As)
@@ -133,7 +133,7 @@
(def: (waiter resource barrier id)
(-> (Atom Text) /.Barrier Nat (Async Any))
(do async.monad
- [_ (/.block barrier)
+ [_ (/.block! barrier)
_ (async.future (atom.update! (|>> (format (%.nat id))) resource))]
(in [])))
@@ -171,7 +171,7 @@
(waiter resource barrier id))))
(monad.seq !))
.let [outcome (io.run! (atom.read! resource))]]
- (_.cover' [/.barrier /.block]
+ (_.cover' [/.barrier /.block!]
(and (text.ends_with? expected_ending outcome)
(list.every? (function (_ id)
(text.contains? (%.nat id) outcome))