int im_iterate( im, start_fn, scan_fn, stop_fn, a, b )
IMAGE *im;
void *(*start_fn)();
int (*scan_fn)();
int (*stop_fn)();
void *a, *b;
where, typically,
void *start_fn( im, a, b )
IMAGE *im;
void *a, *b;
int scan_fn( or, seq, a, b )
REGION *or;
void *seq;
void *a, *b;
int stop_fn( seq, a, b )
void *seq;
void *a, *b;
im_iterate(3) makes one or more regions on im, and starts one or more sequences running over the image. im_iterate(3) guarantees that
- scan_fn() will see each of the pels in im exactly once
- start_fn() and stop_fn() are both exclusive
See the guide, the man page for im_generate(3), and the source to im_deviate(3) for examples.
On machines with SVR4 threads and several CPUs, im_generate(3) and im_iterate(3) automatically parallelise programs. You can set the desired concurrency level with the environment variable IM_CONCURRENCY, for example
example% setenv IM_CONCURRENCY 2
example% stats fred.v
will run stats with enough concurrency to keep 2 CPUs fully occupied. If IM_CONCURRENCY is not set, then it defaults to 1.