Jump to content

thread_pool

From Hugo's wiki

thread_pool applies a function to every element of an array, in parallel.

Synopsis

void thread_pool(T array[arrlen], size_t arrlen, size_t elemsize,
                 void (*func)(T *), int numthreads = NUM_THREADS);

The array can hold any type T: arrlen elements of elemsize bytes each. func receives a pointer to one element and modifies it in place. The optional fourth argument is the number of threads to use.

See also