I am currently testing out pthreads for usage in order to speed up other code I have. Essentially what my code currently has is a couple of for loops that end up doing matrix calculations. I tried spawning threads that will do those calculations simultaneously, and it ended up cutting the runtime in half.
My question is that, is there a way to initially spawn these pthreads, have them run the function, and use them again later to run the same function without them closing? Or is it necessary to close them after performing the task?
I am using Windows by the way, using a pthreads library.