diff options
author | Eduardo Julian | 2018-05-08 22:30:03 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-08 22:30:03 -0400 |
commit | 8c90251c12a4d0d4cc191bfb273bb5eb51bb0356 (patch) | |
tree | 5964bba6bedd134c244bc322df4cced3419ca957 /new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux | |
parent | ca9541c0c10d4e6aa94055ecfb47301ed7292828 (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/runtime.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux | 42 |
1 files changed, 20 insertions, 22 deletions
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 )) |