aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/concurrency/semaphore.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux26
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index 5cf050d4b..fbfacf228 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -33,10 +33,10 @@
(primitive .public Semaphore
(Atom State)
- (def: most_positions_possible
+ (def most_positions_possible
(.nat (at i.interval top)))
- (def: .public (semaphore initial_open_positions)
+ (def .public (semaphore initial_open_positions)
(-> Nat Semaphore)
(let [max_positions (n.min initial_open_positions
..most_positions_possible)]
@@ -44,7 +44,7 @@
#open_positions (.int max_positions)
#waiting_list queue.empty]))))
- (def: .public (wait! semaphore)
+ (def .public (wait! semaphore)
(Ex (_ k) (-> Semaphore (Async Any)))
(let [semaphore (representation semaphore)
[signal sink] (is [(Async Any) (Resolver Any)]
@@ -69,7 +69,7 @@
(exception.report
"Max Positions" (%.nat max_positions)))
- (def: .public (signal! semaphore)
+ (def .public (signal! semaphore)
(Ex (_ k) (-> Semaphore (Async (Try Int))))
(let [semaphore (representation semaphore)]
(async.future
@@ -97,19 +97,19 @@
(primitive .public Mutex
Semaphore
- (def: .public (mutex _)
+ (def .public (mutex _)
(-> Any Mutex)
(abstraction (semaphore 1)))
- (def: acquire!
+ (def acquire!
(-> Mutex (Async Any))
(|>> representation ..wait!))
- (def: release!
+ (def release!
(-> Mutex (Async (Try Int)))
(|>> representation ..signal!))
- (def: .public (synchronize! mutex procedure)
+ (def .public (synchronize! mutex procedure)
(All (_ a) (-> Mutex (IO (Async a)) (Async a)))
(do async.monad
[_ (..acquire! mutex)
@@ -118,7 +118,7 @@
(in output)))
)
-(def: .public limit
+(def .public limit
(refinement.refiner (n.> 0)))
(type: .public Limit
@@ -131,14 +131,14 @@
#start_turnstile Semaphore
#end_turnstile Semaphore])
- (def: .public (barrier limit)
+ (def .public (barrier limit)
(-> Limit Barrier)
(abstraction [#limit limit
#count (atom.atom 0)
#start_turnstile (..semaphore 0)
#end_turnstile (..semaphore 0)]))
- (def: (un_block! times turnstile)
+ (def (un_block! times turnstile)
(-> Nat Semaphore (Async Any))
(loop (again [step 0])
(if (n.< times step)
@@ -148,7 +148,7 @@
(at async.monad in []))))
(with_template [<phase> <update> <goal> <turnstile>]
- [(def: (<phase> barrier)
+ [(def (<phase> barrier)
(-> Barrier (Async Any))
(do async.monad
[.let [barrier (representation barrier)
@@ -164,7 +164,7 @@
[end! -- 0 #end_turnstile]
)
- (def: .public (block! barrier)
+ (def .public (block! barrier)
(-> Barrier (Async Any))
(do async.monad
[_ (..start! barrier)]