Merge branch 'master' into 1.15
This commit is contained in:
commit
a50b00059e
6 files changed
+88
-25
No files matched your search
@@ -68,7 +68,7 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction
|
||||
return (name.equals("_")?"<lambda>":name) +"("+String.join(", ",stringArgs)+")";
|
||||
}
|
||||
|
||||
public String fullName() {return expression.module == null?name:name+"["+expression.module.getName()+"]";}
|
||||
public String fullName() {return (name.equals("_")?"<lambda>":name)+(expression.module == null?"":"["+expression.module.getName()+"]");}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean()
|
||||
|
||||
@@ -4,6 +4,7 @@ import carpet.script.Context;
|
||||
import carpet.script.Expression;
|
||||
import carpet.script.LazyValue;
|
||||
import carpet.script.Tokenizer;
|
||||
import carpet.script.exception.ExpressionException;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -29,7 +30,18 @@ public class ThreadValue extends Value
|
||||
{
|
||||
id = sequence++;
|
||||
taskFuture = CompletableFuture.supplyAsync(
|
||||
() -> function.lazyEval(ctx, Context.NONE, expr, token, args).evalValue(ctx),
|
||||
() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
return function.lazyEval(ctx, Context.NONE, expr, token, args).evalValue(ctx);
|
||||
}
|
||||
catch (ExpressionException exc)
|
||||
{
|
||||
ctx.host.handleExpressionException("Thread failed", exc);
|
||||
return Value.NULL;
|
||||
}
|
||||
},
|
||||
executorServices.computeIfAbsent(pool, (v) -> (ThreadPoolExecutor)Executors.newCachedThreadPool())
|
||||
);
|
||||
Thread.yield();
|
||||
|
||||
Reference in new issue
Block a user