public synchronized void waitForRelease() throws InterruptedException { count++; // The final thread to reach barrier resets barrier and // releases all threads if ( count==threshold ) { // notify blocked threads that threshold has been reached action(); // perform the requested operation notifyAll(); } else while ( count<threshold ) { wait(); } }
public synchronized void waitForRelease() throws InterruptedException { count++; // The final thread to reach barrier resets barrier and // releases all threads if ( count==threshold ) { // notify blocked threads that threshold has been reached action(); // perform the requested operation notifyAll(); } else while ( count<threshold ) { wait(); } }
public synchronized void waitForRelease() throws InterruptedException { count++; // The final thread to reach barrier resets barrier and // releases all threads if ( count==threshold ) { // notify blocked threads that threshold has been reached action(); // perform the requested operation notifyAll(); } else while ( count<threshold ) { wait(); } }
public synchronized void waitForRelease() throws InterruptedException { count++; // The final thread to reach barrier resets barrier and // releases all threads if ( count==threshold ) { // notify blocked threads that threshold has been reached action(); // perform the requested operation notifyAll(); } else while ( count<threshold ) { wait(); } }