Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
したがって、Cでの私の質問は、ループでpthread Joinを使用する場合と比較して、pthreadバリア(initおよびwait..etc)を使用する場合の基本的な違い(おそらく長所と短所)は何ですか。
つまり、ループ内に10個のスレッドを作成し、後でバリアが必要な場所に、すべてのスレッドに対して結合を実行するためのループを配置したとします。それもバリアとして機能しませんか?
どうか明らかにしてください。ありがとう!
pthread_join()参加しているスレッドが終了するまで、呼び出し元のスレッドをブロックします。対照的に、バリアはすべてのスレッドが実行を継続できるようにします。
pthread_join()