/* using a Java monitor to implement semaphores */ public class Semaphore { private int semval; private int maxval; public Semaphore(int m) { maxval = m; semval = 1; } // constructor public synchronized void proberen() { try // wait can cause exception { while (semval == 0) wait(); semval--; } catch (InterruptedException ie) { ie.printStackTrace(); } } public synchronized void verhogen() { if (semval