diff options
Diffstat (limited to 'stdlib/source/lux/control/concurrency')
-rw-r--r-- | stdlib/source/lux/control/concurrency/promise.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/stm.lux | 3 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/thread.lux (renamed from stdlib/source/lux/control/concurrency/process.lux) | 22 |
3 files changed, 16 insertions, 17 deletions
diff --git a/stdlib/source/lux/control/concurrency/promise.lux b/stdlib/source/lux/control/concurrency/promise.lux index 3b6341cf1..017ad67a8 100644 --- a/stdlib/source/lux/control/concurrency/promise.lux +++ b/stdlib/source/lux/control/concurrency/promise.lux @@ -13,7 +13,7 @@ [type abstract]] [// - ["." process] + ["." thread] ["." atom (#+ Atom atom)]]) (abstract: #export (Promise a) @@ -156,19 +156,19 @@ left||right)))) (def: #export (schedule millis-delay computation) - {#.doc (doc "Runs an I/O computation on its own process (after a specified delay)." + {#.doc (doc "Runs an I/O computation on its own thread (after a specified delay)." "Returns a Promise that will eventually host its result.")} (All [a] (-> Nat (IO a) (Promise a))) (let [[!out resolve] (..promise [])] (exec (|> (do io.monad [value computation] (resolve value)) - (process.schedule millis-delay) + (thread.schedule millis-delay) io.run) !out))) (def: #export future - {#.doc (doc "Runs an I/O computation on its own process." + {#.doc (doc "Runs an I/O computation on its own thread." "Returns a Promise that will eventually host its result.")} (All [a] (-> (IO a) (Promise a))) (schedule 0)) diff --git a/stdlib/source/lux/control/concurrency/stm.lux b/stdlib/source/lux/control/concurrency/stm.lux index 259511eb7..d5684cf97 100644 --- a/stdlib/source/lux/control/concurrency/stm.lux +++ b/stdlib/source/lux/control/concurrency/stm.lux @@ -127,8 +127,7 @@ (#.Cons {#var _var #original _original #current _current} - (update-tx-value var value tx'))) - )) + (update-tx-value var value tx'))))) (def: #export (write value var) {#.doc "Writes value to var."} diff --git a/stdlib/source/lux/control/concurrency/process.lux b/stdlib/source/lux/control/concurrency/thread.lux index 5e1bf7c3c..55b635672 100644 --- a/stdlib/source/lux/control/concurrency/process.lux +++ b/stdlib/source/lux/control/concurrency/thread.lux @@ -61,7 +61,7 @@ (as-is (host.import: (setTimeout [host.Function host.Number] #io Any)))} ## Default - (type: Process + (type: Thread {#creation Nat #delay Nat #action (IO Any)}) @@ -95,7 +95,7 @@ ## Default (def: runner - (Atom (List Process)) + (Atom (List Thread)) (atom.atom (list)))) (def: #export (schedule milli-seconds action) @@ -142,13 +142,13 @@ (as-is)} ## Default - (as-is (exception: #export cannot-continue-running-processes) + (as-is (exception: #export cannot-continue-running-threads) (def: #export (run! _) (-> Any (IO Any)) (do {! io.monad} - [processes (atom.read ..runner)] - (case processes + [threads (atom.read ..runner)] + (case threads ## And... we're done! #.Nil (wrap []) @@ -156,16 +156,16 @@ _ (do ! [#let [now (.nat ("lux io current-time")) - [ready pending] (list.partition (function (_ process) - (|> (get@ #creation process) - (n.+ (get@ #delay process)) + [ready pending] (list.partition (function (_ thread) + (|> (get@ #creation thread) + (n.+ (get@ #delay thread)) (n.<= now))) - processes)] - swapped? (atom.compare-and-swap processes pending ..runner)] + threads)] + swapped? (atom.compare-and-swap threads pending ..runner)] (if swapped? (do ! [_ (monad.map ! (get@ #action) ready)] (run! [])) - (error! (ex.construct ..cannot-continue-running-processes [])))) + (error! (ex.construct ..cannot-continue-running-threads [])))) ))) )) |