A way to limit the number of times a function is called in parallel