You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if a celpy Environment instance could be shared amongst threads, or if we should create a new instance when we want to create a runner for a new expression.
I tried to look through the docs and source code but didn't find any reference to this.
One thing I've noticed though is that, when we call the program method, the code is doing an intermediate assignment to an instance variable of the environment, before returning, which I believe can be problematic in terms of thread preemption.
There was no design intention to be thread-safe. There are no internal threads.
An example of using threading.local() to manage storage for an Environment instance would be helpful.
If a change is needed for thread-safety, please help with a scenario that we can use as an acceptance test case, perhaps a simple example that shows multiple threads.
Hello!
I was wondering if a celpy Environment instance could be shared amongst threads, or if we should create a new instance when we want to create a runner for a new expression.
I tried to look through the docs and source code but didn't find any reference to this.
One thing I've noticed though is that, when we call the program method, the code is doing an intermediate assignment to an instance variable of the environment, before returning, which I believe can be problematic in terms of thread preemption.
Nonetheless I might have missed something and would like to get your feedback on this use case.
Thank you very much!
The text was updated successfully, but these errors were encountered: