#include <include/flecs.h> FLECS_API bool ecs_readonly_begin(ecs_world_t *world)
Begin readonly mode. Readonly mode guarantees that no mutations will occur on the world, which makes the world safe to access from multiple threads. While the world is in readonly mode, operations are deferred.
Note that while similar to ecs_defer_begin, deferring only does not guarantee the world is not mutated. Operations that are not deferred (like creating a query) update data structures on the world and are allowed when deferring is enabled, but not when the world is in readonly mode.
The ecs_progress() function automatically enables readonly mode while systems are executed.
When a world has more than one stage, the specific stage must be provided to mutating ECS operations. Failing to do so will throw a readonly assert. A world typically has more than one stage when using threads. An example:
world- The world
- Whether world is in readonly mode.