Pthread Barrier vs Loop Join

So, my question is in C: what are the fundamental differences (possibly pros and cons) using the pthread barrier (init and wait..etc) compared to using pthread Join the loop.

So to speak, I created 10 threads in the loop, and then in the place where I want the barrier, I set the loop to do Join for all threads. Wouldn't that act as a barrier?

Please clarify. Thank!

+3
source share
1 answer

pthread_join()blocks the calling thread until the connecting thread exits. On the contrary, the barrier allows the continued operation of all threads.

+3
source

Source: https://habr.com/ru/post/1778667/


All Articles