#ifndef BOUNDED_COLLECTIVE_SCHEDULER_HPP
#define BOUNDED_COLLECTIVE_SCHEDULER_HPP

#include <cstddef>

typedef void (*collective_task_fn)(
    int taskIndex,
    int workerId,
    int workerCount,
    void* ctx
);

/*
 * totalTasks   : number of independent tasks
 * workerCount  : exact number of worker processes to create
 * taskFn       : callback executed by workers
 * ctx          : shared/user context pointer
 * bindAffinity : if true, workers bind to cpu (workerId % numCPUs)
 *
 * Returns 0 on success, non-zero on failure.
 */
int run_bounded_collective_scheduler(
    int totalTasks,
    int workerCount,
    collective_task_fn taskFn,
    void* ctx,
    bool bindAffinity
);

#endif