开发者

Is IronRuby ScriptSource.Execute thread safe?

开发者 https://www.devze.com 2022-12-15 02:06 出处:网络
We are i开发者_开发问答mplemented expression evaluator via hosting IronRuby engine. Simplified version of evaluator you can see here.

We are i开发者_开发问答mplemented expression evaluator via hosting IronRuby engine. Simplified version of evaluator you can see here.

Now we are trying to get more performance from IronRuby via executing expressions in many threads (and we got it). One question bothers us - is Execute method thread safe?


ScriptRuntime, ScriptEngine, and ScriptScope are all thread safe, designed to be used between threads. Specifically, ScriptScope uses a thread-safe data-store, so ScriptScope can be shared between threads.

If you provide your own scope for scripts to execute against, you will need to ensure that scope's data store is thread-safe. Also, when mutating data in a ScriptScope, thread-safety is ensured by locking, so be aware that many different threads mutating a shared ScriptScope will degrade performance. Reading data from a ScriptScope does not lock.

0

精彩评论

暂无评论...
验证码 换一张
取 消