Function ecs_enable_locking


#include <include/flecs.h>

FLECS_API bool ecs_enable_locking(ecs_world_t *world, bool enable)


Enable world locking while in progress. When locking is enabled, Flecs will lock the world while in progress. This allows applications to interact with the world from other threads without running into race conditions.

This is a better alternative to applications putting a lock around calls to ecs_progress, since ecs_progress can sleep when FPS control is enabled, which is time during which other threads could perform work.

Locking must be enabled before applications can use the ecs_lock and ecs_unlock functions. Locking is turned off by default.


world - The world.

enable - True if locking is to be enabled.

The previous value of the setting.


Line 1116 in include/flecs.h.