flecs-hub / flecs-lua

Lua script host for flecs
MIT License
51 stars 9 forks source link

Threading #3

Open randy408 opened 4 years ago

randy408 commented 4 years ago

Lua has a GIL which means calling into a VM from multiple threads will always result in locking. To get around this most threading implementation e.g. effil create their own OS threads with separate VM's.

Worker threads will have limitations e.g. require/ecs.import can't be used to reinitialize shared variables in a module because import functions are not idempotent, the modules have to be copied to/shared with the worker states.

Torch threads seem to be more efficient for this.