#include #include "parapat.h" typedef struct { int v; } arg_t; void *test_work(void *v) { arg_t *a = v; a->v *= 2; return a; } void *test_fold(void *a, void *b) { arg_t *x = a, *y = b; x->v += y->v; return x; } int main() { int i; arg_t a, *res = &a; arg_t args[10]; arg_t *ptrs[10]; work *fns[4] = { &test_work, &test_work, &test_work, &test_work }; pipeline *pl; for (i = 0; i < 10; ++i) { args[i].v = i; ptrs[i] = &args[i]; } a.v = 0; res = create_farm(&test_work, &test_fold, 10, (void **) &ptrs[0]); printf("after farm: %d\n", res->v); pl = create_pipeline(fns, 4); push(pl->in, res); res = pop(pl->out); printf("after pipeline: %d\n", res->v); return 0; }