Function ecs_get_stage


#include <include/flecs.h>

FLECS_API ecs_world_t * ecs_get_stage(const ecs_world_t *world, int32_t stage_id)


Get stage-specific world pointer. Flecs threads can safely invoke the API as long as they have a private context to write to, also referred to as the stage. This function returns a pointer to a stage, disguised as a world pointer.

Note that this function does not(!) create a new world. It simply wraps the existing world in a thread-specific context, which the API knows how to unwrap. The reason the stage is returned as an ecs_world_t is so that it can be passed transparently to the existing API functions, vs. having to create a dediated API for threading.


world - The world.

stage_id - The index of the stage to retrieve.

A thread-specific pointer to the world.


Line 4367 in include/flecs.h.