I've been trying to implement logarithm barrier with condition variables using algorithm Log Barrier using PThread Condition Variables : CS 484 but I think it is missing something, because in the end, some of the threads are waiting for signal. The only thing I modified was removing these lines:


/* I am the last one in */
/* swap the new value pointer with the old value pointer */
tmp = oplate;
oplate = iplate;
iplate = tmp;
/*fprintf(stderr,"%d: swapping pointers\n", thread_id);*/


/* set the keepgoing flag and let everybody go */
keepgoing = 0;
for (q = 0; q < nproc; q++)
keepgoing += lkeepgoing[q];

Because they were unused (maybe the author has forgotten to post some additional code).
Could you please tell me what is wrong with it? Thanks.