java - Custom CyclicBarrier implementaion -
greeting stackoverflow,,, i'm trying implement own cyclicbarrier , came with, have idea what's problem.
public class mybarrier { int arrived = 0; final int threads; public synchronized void sync(thread thread) throws interruptedexception { arrived++; if (arrived == threads) { arrived = 0; notifyall(); } else { while (arrived > 0) { wait(); } } } }
Comments
Post a Comment