Function ecs_enable_locking

Synopsis

#include <include/flecs.h>

FLECS_API bool ecs_enable_locking(ecs_world_t *world, bool enable)

Description

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.

Parameters

world - The world.

enable - True if locking is to be enabled.

Returns
The previous value of the setting.

Source

Line 675 in include/flecs.h.