ecs_get_stage

Function ecs_get_stage 

Source
pub unsafe extern "C" fn ecs_get_stage(
    world: *const ecs_world_t,
    stage_id: i32,
) -> *mut ecs_world_t
Expand description

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.

@param world The world. @param stage_id The index of the stage to retrieve. @return A thread-specific pointer to the world.