diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/concurrency/actor.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/atom.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/promise.lux | 3 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/semaphore.lux | 12 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/stm.lux | 4 |
5 files changed, 14 insertions, 13 deletions
diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index a790fa89c..660b6a9a0 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -62,12 +62,12 @@ (wrap #.Nil)))) (abstract: #export (Actor s) - {#.doc "An actor, defined as all the necessities it requires."} - {#obituary [(Promise <Obituary>) (Resolver <Obituary>)] #mailbox (Atom <Mailbox>)} + {#.doc "An actor, defined as all the necessities it requires."} + ## TODO: Delete after new-luxc becomes the new standard compiler. (def: (actor mailbox obituary) (All [s] diff --git a/stdlib/source/lux/control/concurrency/atom.lux b/stdlib/source/lux/control/concurrency/atom.lux index 6abe4e756..8da6b0935 100644 --- a/stdlib/source/lux/control/concurrency/atom.lux +++ b/stdlib/source/lux/control/concurrency/atom.lux @@ -27,8 +27,6 @@ (as-is)) (abstract: #export (Atom a) - {#.doc "Atomic references that are safe to mutate concurrently."} - (for {@.old (java/util/concurrent/atomic/AtomicReference a) @@ -39,6 +37,8 @@ (array.Array a) }) + {#.doc "Atomic references that are safe to mutate concurrently."} + (def: #export (atom value) (All [a] (-> a (Atom a))) (:abstraction (for {@.old diff --git a/stdlib/source/lux/control/concurrency/promise.lux b/stdlib/source/lux/control/concurrency/promise.lux index a0461e2c1..e396b0769 100644 --- a/stdlib/source/lux/control/concurrency/promise.lux +++ b/stdlib/source/lux/control/concurrency/promise.lux @@ -17,9 +17,10 @@ ["." atom (#+ Atom atom)]]) (abstract: #export (Promise a) - {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."} (Atom [(Maybe a) (List (-> a (IO Any)))]) + {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."} + (type: #export (Resolver a) (-> a (IO Bit))) diff --git a/stdlib/source/lux/control/concurrency/semaphore.lux b/stdlib/source/lux/control/concurrency/semaphore.lux index c69859138..3edcbd332 100644 --- a/stdlib/source/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/lux/control/concurrency/semaphore.lux @@ -28,10 +28,10 @@ #waiting-list (Queue (Resolver Any))}) (abstract: #export Semaphore - {#.doc "A tool for controlling access to resources by multiple concurrent processes."} - (Atom State) + {#.doc "A tool for controlling access to resources by multiple concurrent processes."} + (def: most-positions-possible (.nat (:: i.interval top))) @@ -114,10 +114,10 @@ ) (abstract: #export Mutex - {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."} - Semaphore + {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."} + (def: #export (mutex _) (-> Any Mutex) (:abstraction (semaphore 1))) @@ -143,13 +143,13 @@ (type: #export Limit (:~ (refinement.type limit))) (abstract: #export Barrier - {#.doc "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier."} - {#limit Limit #count (Atom Nat) #start-turnstile Semaphore #end-turnstile Semaphore} + {#.doc "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier."} + (def: #export (barrier limit) (-> Limit Barrier) (:abstraction {#limit limit diff --git a/stdlib/source/lux/control/concurrency/stm.lux b/stdlib/source/lux/control/concurrency/stm.lux index 9c82788ad..0743a0720 100644 --- a/stdlib/source/lux/control/concurrency/stm.lux +++ b/stdlib/source/lux/control/concurrency/stm.lux @@ -23,10 +23,10 @@ (-> a (IO Any))) (abstract: #export (Var a) - {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."} - (Atom [a (List (Sink a))]) + {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."} + (def: #export (var value) {#.doc "Creates a new STM var, with a default value."} (All [a] (-> a (Var a))) |