Is there a pthread equivalent to WatiForMultipleObjects -


I have the following Windows code that produces two threads and waits until both of them are complete Go.

  hThreads [0] = _beginthread (and do_a, 0, p_args_a); HThreads [1] = _beginthread (and do_b, 0, p_args_b); WaitingFormaltultubjects (2, httruds, TRUE, INFINITE);  

Now I'm porting the same code to using pthreads, but how to do WaitForMultipleObjects , it's uncertain:

(& HThreads [0], 0, and do_a, p_args_a); Pthread_create (& amp; hThreads [1], 0, and do_b, p_args_b); ???

To achieve the same functionality, is there a similar way using pthreads?

If you want to wait for everyone, as you are doing here, then you For the thread, just call pthread_join () . It will complete the same task.

Pthread_create (& hThreads [1], 0 , And do_b, p_args_b); Pthread_join (hThreads [0], NULL); Pthread_join (hThreads [1], NULL);

You can get fancy and if you meet more than two threads then do it in the loop.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -