Entitas icon indicating copy to clipboard operation
Entitas copied to clipboard

Thread Safety of EntitasCache

Open wolfgang-wdw opened this issue 6 years ago • 3 comments

Hi,

We are using Entitas on a server and I am currently trying to start server instances in multiple threads, and I noticed that the class EntitasCache is not thread-safe, through the use of the static instance of ObjectCache. Are there any plans to fix this, for example by wrapping that instance inside a ThreadLocal? Are there other places where static instances are used, i.e. should I forget the idea of running different Context instances safely in different threads?

Thanks, Wofgang

wolfgang-wdw avatar May 03 '18 15:05 wolfgang-wdw

I also want to know more tips about how to run Entitas safely in a multi-threading environment.

zhuchun avatar May 13 '18 08:05 zhuchun

@wolfgang-wdw If you spot areas that can be improved to better support multi threading I encourage you to make a PR. Unfortunately, I'm not working on a project that uses multiple threads atm, so my attempts to make Entitas safer would be based on artificial scenarios and probably incomplete. But I'd be happy to exchange experience with you and make Entitas work better in your case!

sschmid avatar Jun 07 '18 17:06 sschmid

related PR #919

sschmid avatar Sep 09 '22 21:09 sschmid