Pthread Barrier vs. Loop Join
So my question in C is: what is basically the differences (maybe pros and cons) of using a pthread barrier (init and wait..etc) compared to using the pthread Join in a loop.
So say I created 10 threads in a loop, and then later at the place of 开发者_高级运维where I want a barrier, I put a loop to do Join for all the threads. Wouldn't that act as a Barrier too?
Please clarify. Thanks!
pthread_join()
blocks the calling thread until the joining thread exits. In contrast, a barrier allows the all threads to continue running.
精彩评论