In C/C++
no code runs "at the same time" (in parallel) just by itself
*. If you call a function, then the
calling function is "blocked" (suspended) at the point of the function call, and the
called function runs in the very same thread as the
calling function; the
calling function will
not be "resumed" until the
called function returns.
Recursive functions, i.e. functions that call themselves, are
no different in this regard!
If you want the
called function to run "in parallel" to the
calling function, i.e. if you want the function call to
not be "blocking", then you have to start a separate
thread, e.g. by using
pthread or by using
std::thread
:
https://cplusplus.com/reference/thread/thread/
https://www.cs.cmu.edu/afs/cs/academic/class/15492-f07/www/pthreads.html
OpenMP is yet another option for
parallel programming:
https://en.wikipedia.org/wiki/OpenMP
But be aware: Even if you create
multiple threads (or processes), those will
not really run "at the same time", at least
not necessarily, but instead they will run in an "interleaved" fashion on the available CPU cores.
(*) as far as a single process is concerned, I mean; separate processes always run concurrently, of course!