From 8c90251c12a4d0d4cc191bfb273bb5eb51bb0356 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 8 May 2018 22:30:03 -0400 Subject: - Re-named "lux process concurrency-level" to "lux process parallelism-level". - Merged the functionality of "lux process future" into "lux process schedule". --- .../lang/translation/r/procedure/common.jvm.lux | 5 ++- .../source/luxc/lang/translation/r/runtime.jvm.lux | 42 +++++++++++----------- 2 files changed, 22 insertions(+), 25 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/r') 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) - (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 )) -- cgit v1.2.3