" CompiledScript. Execute " thread safe?
CompiledScript. Execute(ScriptEngine engine) For different " ScriptEngine " Whether or not a thread - safe? Because the repeated use of " CompiledScript " can save a lot of parse time, but I don't know if this is appropriate?
Yes, CompiledScript.Execute() should be thread-safe.
Edit: provided you use a different ScriptEngine for each thread.
thank you.
" EvalMethodGenerator " class in the parameter when it was new " scope " Can I use " ObjectScope.CreateGlobalPlaceholder ( ) "?
Because I want to dynamically initializes, and saves some used similar (function(){...}) script MethodGenerator for repeated use.
For this reason I changed MethodGenerator give it added a public object Execute(ScriptEngine engine,Scope scope,object thisObject) method
example:
//At initialization time
var methodGen = new EvalMethodGenerator(
ObjectScope.CreateGlobalPlaceholder(),
source, // The source code.
options ?? new CompilerOptions(),
null);
//When called
var runtimeScope = ((ObjectScope)methodGen.InitialScope).ConvertPlaceholderToRuntimeScope(engine.Global);
return methodGen.Execute(engine, runtimeScope, engine.Global);
Do it, what would be the problem?
--Sorry my English is very bad, please understand
I'm not entirely sure what you're asking. I think what you're doing is essentially the same as what CompiledScript does, and therefore it should also be thread-safe.
Thank you very much, jurassic is doing extremely well