开发者

Pthread Barrier vs. Loop Join

开发者 https://www.devze.com 2023-01-28 20:24 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消