void () { synchronized (myLock) { assert ! myStarted; myStarted = true; myFinished = false; } mySemaphore.down(); mySemaphore.waitFor(); synchronized (myLock) { myStarted = false; myFinished = true; ++ myCnt; } }