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". --- .../translation/python/procedure/common.jvm.lux | 5 ++-- .../luxc/lang/translation/python/runtime.jvm.lux | 29 ++++++++-------------- 2 files changed, 13 insertions(+), 21 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/python') diff --git a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux index 7a907edb0..e76b369fc 100644 --- a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux @@ -463,7 +463,7 @@ (install "write" (binary box//write))))) ## [[Processes]] -(def: (process//concurrency-level []) +(def: (process//parallelism-level []) Nullary (python.int 1)) @@ -475,8 +475,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/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux index a7bd45ff8..8167537f5 100644 --- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux @@ -355,32 +355,25 @@ (def: runtime//box Runtime - ($_ python.then! - @@box//write)) - -(runtime: (process//future procedure) - ($_ python.then! - (python.import! "threading") - (let [params (python.dict (list [(python.string "target") procedure]))] - (python.do! (|> (python.global "threading") - (python.send-keyword (list) params "Thread") - (python.send (list) "start")))) - (python.return! ..unit))) + @@box//write) (runtime: (process//schedule milli-seconds procedure) ($_ python.then! (python.import! "threading") - (let [seconds (|> milli-seconds (python./ (python.float 1_000.0)))] - (python.do! (|> (python.global "threading") - (python.send (list seconds procedure) "Timer") - (python.send (list) "start")))) + (python.if! (python.= (python.int 0) milli-seconds) + (let [params (python.dict (list [(python.string "target") procedure]))] + (python.do! (|> (python.global "threading") + (python.send-keyword (list) params "Thread") + (python.send (list) "start")))) + (let [seconds (|> milli-seconds (python./ (python.float 1_000.0)))] + (python.do! (|> (python.global "threading") + (python.send (list seconds procedure) "Timer") + (python.send (list) "start"))))) (python.return! ..unit))) (def: runtime//process Runtime - ($_ python.then! - @@process//future - @@process//schedule)) + @@process//schedule) (do-template [ ] [(runtime: ( input) -- cgit v1.2.3