aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/concurrency/semaphore.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/concurrency/semaphore.lux')
-rw-r--r--stdlib/source/lux/concurrency/semaphore.lux22
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux
index c9ac32fcb..23303a236 100644
--- a/stdlib/source/lux/concurrency/semaphore.lux
+++ b/stdlib/source/lux/concurrency/semaphore.lux
@@ -9,7 +9,7 @@
(type: State
{#open-positions Nat
- #waiting-list (List (Promise Top))})
+ #waiting-list (List (Promise Any))})
(abstract: #export Semaphore
{#.doc "A tool for controlling access to resources by multiple concurrent processes."}
@@ -22,10 +22,10 @@
#waiting-list (list)})))
(def: #export (wait semaphore)
- (Ex [k] (-> Semaphore (Promise Top)))
+ (Ex [k] (-> Semaphore (Promise Any)))
(let [semaphore (@representation semaphore)]
(io.run
- (loop [signal (: (Promise Top)
+ (loop [signal (: (Promise Any)
(promise.promise #.None))]
(do io.Monad<IO>
[state (atom.read semaphore)
@@ -44,13 +44,13 @@
(recur signal)))))))
(def: #export (signal semaphore)
- (Ex [k] (-> Semaphore (Promise Top)))
+ (Ex [k] (-> Semaphore (Promise Any)))
(let [semaphore (@representation semaphore)]
(promise.future
(loop [_ []]
(do io.Monad<IO>
[state (atom.read semaphore)
- #let [[?signal state'] (: [(Maybe (Promise Top)) State]
+ #let [[?signal state'] (: [(Maybe (Promise Any)) State]
(case (get@ #waiting-list state)
#.Nil
[#.None (update@ #open-positions inc state)]
@@ -76,15 +76,15 @@
Semaphore
(def: #export (mutex _)
- (-> Top Mutex)
+ (-> Any Mutex)
(@abstraction (semaphore +1)))
(def: (acquire mutex)
- (-> Mutex (Promise Top))
+ (-> Mutex (Promise Any))
(wait (@representation mutex)))
(def: (release mutex)
- (-> Mutex (Promise Top))
+ (-> Mutex (Promise Any))
(signal (@representation mutex)))
(def: #export (synchronize mutex procedure)
@@ -115,7 +115,7 @@
#end-turnstile (semaphore +0)}))
(def: (un-block times turnstile)
- (-> Nat Semaphore (Promise Top))
+ (-> Nat Semaphore (Promise Any))
(loop [step +0]
(if (n/< times step)
(do promise.Monad<Promise>
@@ -125,7 +125,7 @@
(do-template [<phase> <update> <goal> <turnstile>]
[(def: (<phase> (^@representation barrier))
- (-> Barrier (Promise Top))
+ (-> Barrier (Promise Any))
(do promise.Monad<Promise>
[#let [limit (refinement.un-refine (get@ #limit barrier))
goal <goal>
@@ -140,7 +140,7 @@
)
(def: #export (block barrier)
- (-> Barrier (Promise Top))
+ (-> Barrier (Promise Any))
(do promise.Monad<Promise>
[_ (start barrier)]
(end barrier)))