I’ve basically done this but my when I run the app, it runs the thread too many times too quickly before freezing.
Looking to have my thread run through once, pause and then start the thread again.
I have tried:
while (running.get()) {
Thread threadstart = new Thread()
{
public void run(){
try {
Thread.sleep(integerTime);
and then had
threadstart.start();
at the end. This is my exact code just with all the processes taken out.
All advice appreciated.
You’re sleeping in the new thread – so your while loop will keep spawning new threads at a very fast rate, each of which will sleep.
Why not just create one thread which has the loop?