Distributes the execution of a function across multiple threads, by calling it with a different index on each thread.
| max_n |
the maximal number of threads to use |
| func |
the function to call |
| user_data |
user data to pass to the function |