I don't think pthreads() will help you here regardless, especially if Expansion is relatively quick. It also looks as if each iteration of the loop depends on the completion of the previous iteration. So it probably makes more sense to parallelize an outer loop (the one you have not shown us).