I have a thread running but from outside I can\'t bypass a value to stop that thread. How can I send false/true value inside Mytest()
or call running thread pub
Apart from the fact, that this thread is a heating test for your CPU ;)
You can call the start/stop methods with
MyThread.start();
MyThread.stop();
You've defined them as static
methods, so the above lines of code show how to call them.
for the heating... add something like
try {
Thread.sleep(100); // value is milliseconds
} catch (InterruptedException e) {
// no need to handle (in this example)
}
This will reduce the CPU load from 100% (on one core) to a reasonable value ;)