Fixed threading and add shutdown control for threads via sleep

This commit is contained in:
gnembon committed 2020-10-24 22:18:02 -03:00
1 parent e50298a306
commit 1268af4131
8 files changed
+162 -107

No files matched your search

+1 -11
View File
@@ -294,17 +294,7 @@ public class Sys {
System.out.println(v.getString());
return v; // pass through for variables
});
expression.addUnaryFunction("sleep", (v) ->
{
long time = NumericValue.asNumber(v).getLong();
try
{
Thread.sleep(time);
Thread.yield();
}
catch (InterruptedException ignored) { }
return v; // pass through for variables
});
expression.addLazyFunction("time", 0, (c, t, lv) ->
{
Value time = new NumericValue((System.nanoTime() / 1000) / 1000.0);