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/ruby/procedure/common.jvm.lux | 9 ++------- .../luxc/lang/translation/ruby/runtime.jvm.lux | 21 ++++++++------------- 2 files changed, 10 insertions(+), 20 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/ruby') diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux index bcc555fe2..a8d4efc4a 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux @@ -526,14 +526,10 @@ (install "write" (binary box//write))))) ## [[Processes]] -(def: (process//concurrency-level []) +(def: (process//parallelism-level []) Nullary (ruby.int 1)) -(def: process//future - Unary - runtimeT.process//future) - (def: (process//schedule [milli-secondsO procedureO]) Binary (runtimeT.process//schedule milli-secondsO procedureO)) @@ -542,8 +538,7 @@ Bundle (<| (prefix "process") (|> (dict.new text.Hash) - (install "concurrency-level" (nullary process//concurrency-level)) - (install "future" (unary process//future)) + (install "parallelism-level" (nullary process//parallelism-level)) (install "schedule" (binary process//schedule)) ))) diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux index ef840d210..e2bf83dfa 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux @@ -243,23 +243,18 @@ Runtime (format @@box//write)) -(runtime: (process//future procedure) - (ruby.and (format "(Thread.new {" - (ruby.statement (ruby.call (list ..unit) procedure)) - "})") - ..unit)) - (runtime: (process//schedule milli-seconds procedure) - (ruby.and (format "(Thread.new {" - (ruby.statement (ruby.apply "sleep" (list (ruby./ (ruby.float 1_000.0) milli-seconds)))) - (ruby.statement (ruby.call (list ..unit) procedure)) - "})") - ..unit)) + (ruby.block! + (list (format "(Thread.new {" + (ruby.when! (ruby.not (ruby.= (ruby.int 0) milli-seconds)) + (ruby.statement (ruby.apply "sleep" (list (ruby./ (ruby.float 1_000.0) milli-seconds))))) + (ruby.statement (ruby.call (list ..unit) procedure)) + "})") + (ruby.return! ..unit)))) (def: runtime//process Runtime - (format @@process//future - @@process//schedule)) + @@process//schedule) (def: runtime Runtime -- cgit v1.2.3