Jan-25-2019, 04:26 AM
To halt execution of the main thread while the timer is running, call the Timer.join() method. This forces the calling thread to wait for the Timer to complete.
As for the cancel operation, I'm thinking that you'll need a second thread. The second thread would call a function requesting input. If input is given, it cancels the countdelay() thread; if no input is given and the countdelay thread is completed, the thread terminates.
As for the cancel operation, I'm thinking that you'll need a second thread. The second thread would call a function requesting input. If input is given, it cancels the countdelay() thread; if no input is given and the countdelay thread is completed, the thread terminates.