#ifndef ONE_TO_MANY_SCHEDULER_HPP
#define ONE_TO_MANY_SCHEDULER_HPP

/*
    Task function used by the shared-memory benchmark.

    taskId      = frame index, from 0 to taskCount - 1
    workerId    = zero-based worker index
    workerCount = total number of workers
    ctx         = user context, in shm_benchmark this points to MatrixSortContext
*/
typedef void (*OneToManyPipeTaskFunction)(int taskId,
                                          int workerId,
                                          int workerCount,
                                          void* ctx);

/*
    One-to-Many pipe scheduler.

    Mechanism:
        - every worker has one private parent-to-child assignment pipe
        - parent assigns chunks round-robin
        - no child-to-parent request pipe
*/
int run_one_to_many_pipe_scheduler(int taskCount,
                                   int workerCount,
                                   OneToManyPipeTaskFunction taskFn,
                                   void* ctx,
                                   bool useAffinity);

#endif
