aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/r
diff options
context:
space:
mode:
authorEduardo Julian2018-05-08 22:30:03 -0400
committerEduardo Julian2018-05-08 22:30:03 -0400
commit8c90251c12a4d0d4cc191bfb273bb5eb51bb0356 (patch)
tree5964bba6bedd134c244bc322df4cced3419ca957 /new-luxc/source/luxc/lang/translation/r
parentca9541c0c10d4e6aa94055ecfb47301ed7292828 (diff)
- Re-named "lux process concurrency-level" to "lux process parallelism-level".
- Merged the functionality of "lux process future" into "lux process schedule".
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/r')
-rw-r--r--new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux5
-rw-r--r--new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux42
2 files changed, 22 insertions, 25 deletions
diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
index 5c4909d9b..582cda4c6 100644
--- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
@@ -460,7 +460,7 @@
(install "write" (binary box//write)))))
## [[Processes]]
-(def: (process//concurrency-level [])
+(def: (process//parallelism-level [])
Nullary
(r.int 1))
@@ -472,8 +472,7 @@
Bundle
(<| (prefix "process")
(|> (dict.new text.Hash<Text>)
- (install "concurrency-level" (nullary process//concurrency-level))
- (install "future" (unary runtimeT.process//future))
+ (install "parallelism-level" (nullary process//parallelism-level))
(install "schedule" (binary process//schedule))
)))
diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
index 5f073eb17..f13329e26 100644
--- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
@@ -829,35 +829,33 @@
(r.when (|> (r.length (@@ queue)) (r.> (r.int 0)))
(process//loop ..unit)))))))
-(runtime: (process//future procedure)
- ($_ r.then
- (list-append! (@@ procedure) process//incoming)
- ..unit))
-
(runtime: (process//schedule milli-seconds procedure)
- (let [to-seconds (|>> (r./ (r.float 1_000.0)))
- to-millis (|>> (r.* (r.float 1_000.0)))]
- (with-vars [start now seconds _arg elapsed-time]
- ($_ r.then
- (r.set! start current-time-float)
- (r.set! seconds (to-seconds (int//to-float (@@ milli-seconds))))
- (list-append! (r.function (list _arg)
- ($_ r.then
- (r.set! now current-time-float)
- (r.set! elapsed-time (|> (@@ now) (r.- (@@ start))))
- (r.if (|> (@@ elapsed-time) (r.>= (@@ seconds)))
- (@@ procedure)
- (process//schedule (to-millis (@@ elapsed-time))
- (@@ procedure)))))
- process//incoming)
- ..unit))))
+ (r.if (r.= (r.int 0) (@@ milli-seconds))
+ ($_ r.then
+ (list-append! (@@ procedure) process//incoming)
+ ..unit)
+ (let [to-seconds (|>> (r./ (r.float 1_000.0)))
+ to-millis (|>> (r.* (r.float 1_000.0)))]
+ (with-vars [start now seconds _arg elapsed-time]
+ ($_ r.then
+ (r.set! start current-time-float)
+ (r.set! seconds (to-seconds (int//to-float (@@ milli-seconds))))
+ (list-append! (r.function (list _arg)
+ ($_ r.then
+ (r.set! now current-time-float)
+ (r.set! elapsed-time (|> (@@ now) (r.- (@@ start))))
+ (r.if (|> (@@ elapsed-time) (r.>= (@@ seconds)))
+ (@@ procedure)
+ (process//schedule (to-millis (@@ elapsed-time))
+ (@@ procedure)))))
+ process//incoming)
+ ..unit)))))
(def: runtime//process
Runtime
($_ r.then
(r.set! process//incoming (r.list (list)))
@@process//loop
- @@process//future
@@process//schedule
))