I have the following Windows code that spawns two threads then waits until they have both completed:
hThreads[0] = _beginthread(&do_a, 0, p_args_a);
hThreads[1] = _beginthread(&do_b, 0, p_args_b);
WaitForMultipleObjects(2, hThreads, TRUE, INFINITE);
I am now porting the same code to use pthreads but am unsure how to do the equivalent of WaitForMultipleObjects
:
pthread_create(&hThreads[0], 0, &do_a, p_args_a);
pthread_create(&hThreads[1], 0, &do_b, p_args_b);
???
Is there an equivalent way, using pthreads, to achieve the same functionality?