Fixed threading and add shutdown control for threads via sleep
This commit is contained in:
1 parent
e50298a306
commit
1268af4131
8 files changed
+162
-107
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user