Execute Threads Parallelly at Given Time: pthread_barrier_t

Why we need pthread_barrier_t? When multiple threads are working together, it might be required that the threads wait for each other at a certain event or point in the program before proceeding ahead. Let us say we have four threads, each of which is going to initialize a global variable. The 4 variables, in turn, might be used by all the four threads. Thus it would be feasible that all the threads wait for each other to finish the initialization of the variables before proceeding....

September 10, 2016 · 3 min · 478 words · Vishal Chovatiya