flecs-hub / flecs-lua

Lua script host for flecs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Threading

randy408 opened this issue · comments

commented

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.