aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/scheme
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/scheme
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/scheme')
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux5
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux28
2 files changed, 17 insertions, 16 deletions
diff --git a/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
index 727f6fc40..e4b6ccde5 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
@@ -427,7 +427,7 @@
(install "write" (binary box//write)))))
## [[Processes]]
-(def: (process//concurrency-level [])
+(def: (process//parallelism-level [])
Nullary
(_.int 1))
@@ -439,8 +439,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/scheme/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
index c4cd0a909..3bdfc614f 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
@@ -327,25 +327,27 @@
(@@ queue)))
(process//loop ..unit)))))))
-(runtime: (process//future procedure)
- (_.begin (list (_.set! process//incoming (_.cons (@@ procedure) (@@ process//incoming)))
- ..unit)))
-
(runtime: (process//schedule milli-seconds procedure)
- (with-vars [start process now _ignored]
- (_.let (list [start (io//current-time ..unit)])
- (_.letrec (list [process (_.lambda _ignored
- (_.let (list [now (io//current-time ..unit)])
- (_.if (|> (@@ now) (_.- (@@ start)) (_.>= (@@ milli-seconds)))
- (_.apply (@@ procedure) (list ..unit))
- (process//future (@@ process)))))])
- (process//future (@@ process))))))
+ (let [process//future (function (_ process)
+ (_.set! process//incoming (_.cons process (@@ process//incoming))))]
+ (_.begin
+ (list
+ (_.if (_.= (_.int 0) (@@ milli-seconds))
+ (process//future (@@ procedure))
+ (with-vars [start process now _ignored]
+ (_.let (list [start (io//current-time ..unit)])
+ (_.letrec (list [process (_.lambda _ignored
+ (_.let (list [now (io//current-time ..unit)])
+ (_.if (|> (@@ now) (_.- (@@ start)) (_.>= (@@ milli-seconds)))
+ (_.apply (@@ procedure) (list ..unit))
+ (process//future (@@ process)))))])
+ (process//future (@@ process))))))
+ ..unit))))
(def: runtime//process
Runtime
(_.begin (list (_.define process//incoming (list) (_.list (list)))
@@process//loop
- @@process//future
@@process//schedule)))
(def: runtime