Function ecs_worker_iter


#include <include/flecs.h>

FLECS_API ecs_iter_t ecs_worker_iter(const ecs_iter_t *it, int32_t index, int32_t count)


Create a worker iterator. Worker iterators can be used to equally divide the number of matched entities across N resources (usually threads). Each resource will process the total number of matched entities divided by 'count'.

Entities are distributed across resources such that the distribution is stable between queries. Two queries that match the same table are guaranteed to match the same entities in that table.

The iterator must be iterated with ecs_worker_next.

A worker iterator acts as a passthrough for data exposed by the parent iterator, so that any data provided by the parent will also be provided by the worker iterator.


it - The source iterator.

index - The index of the current resource.

count - The total number of resources to divide entities between.

A worker iterator.


Line 3915 in include/flecs.h.