aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/r
diff options
context:
space:
mode:
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
))