diff options
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/semaphore.lux')
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/semaphore.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index b4b07bbb0..796a1604e 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -39,7 +39,7 @@ (_.for [/.Semaphore] ($_ _.and (do {! random.monad} - [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) + [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [result (async.within ..delay (/.wait! semaphore))] @@ -51,10 +51,10 @@ #.None false))))) (do {! random.monad} - [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) + [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} - [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore)) + [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore)) result (async.within ..delay (/.wait! semaphore))] (_.cover' [/.wait!] (case result @@ -64,10 +64,10 @@ #.None true))))) (do {! random.monad} - [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) + [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} - [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore)) + [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore)) .let [block (/.wait! semaphore)] result/0 (async.within ..delay block) open_positions (/.signal! semaphore) @@ -80,7 +80,7 @@ _ false))))) (do {! random.monad} - [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) + [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [outcome (/.signal! semaphore)] @@ -98,7 +98,7 @@ (_.for [/.Mutex] ($_ _.and (do {! random.monad} - [repetitions (|> random.nat (\ ! map (|>> (n.% 100) (n.max 10)))) + [repetitions (|> random.nat (\ ! each (|>> (n.% 100) (n.max 10)))) .let [resource (atom.atom "") expected_As (text.together (list.repeated repetitions "A")) expected_Bs (text.together (list.repeated repetitions "B")) @@ -155,7 +155,7 @@ _ false))) (do {! random.monad} - [limit (\ ! map (|>> (n.% 9) ++) random.nat) + [limit (\ ! each (|>> (n.% 9) ++) random.nat) .let [barrier (/.barrier (maybe.trusted (/.limit limit))) resource (atom.atom "")]] (in (do {! async.monad} @@ -165,10 +165,10 @@ text.together) expected_ids (enum.range n.enum 0 (-- limit))] _ (|> expected_ids - (list\map (function (_ id) - (exec - (io.run! (atom.update! (|>> (format suffix)) resource)) - (waiter resource barrier id)))) + (list\each (function (_ id) + (exec + (io.run! (atom.update! (|>> (format suffix)) resource)) + (waiter resource barrier id)))) (monad.all !)) .let [outcome (io.run! (atom.read! resource))]] (_.cover' [/.barrier /.block!] |