added variables and semaphores to Synch.java