Reputation: 1729
I need to execute a block every 1 second, but it needs to be in the same thread. This means, from what I understand, that I can't make the use of a timer class.
Is there a way to do what I want?
Upvotes: 0
Views: 2588
Reputation: 1478
Create a thread and write a loop like so -
while(true)
{
// do something
Thread.sleep(1000);
}
Upvotes: 3