Function ecs_table_lock


#include <include/flecs.h>

FLECS_API void ecs_table_lock(ecs_world_t *world, ecs_table_t *table)


Lock or unlock table. When a table is locked, modifications to it will throw an assert. When the table is locked recursively, it will take an equal amount of unlock operations to actually unlock the table.

Table locks can be used to build safe iterators where it is guaranteed that the contents of a table are not modified while it is being iterated.

The operation only works when called on the world, and has no side effects when called on a stage. The assumption is that when called on a stage, operations are deferred already.


world - The world.

table - The table to lock.


Line 4854 in include/flecs.h.