In my program I have 2 threads, the first is running constantly while (isRunning) {
and for the second thread method, I need it to sleep for a minute while its true.
The problem I am facing that with my current code is that I am getting a Not Responding
for my program in the Task Manager.
How can I fix that, note that I am using Framework 2.0.
private void initialize() {
MyWeb.connectToServer();
commandThread = new Thread(checkForCommandThread); // The thread that I need not to freeze the program
commandThread.Start();
}
private void checkForCommandThread() {
while (isRunning) {
Thread.Sleep(10000);
// while this thread is sleeping, the program should not be frozen
// do the work here, after the sleep
}
}