So, I'm searching on net for a while and now I'm confused... do I need to explicitly end thread after code is executed or thread does it automatically?
Code:
Runnable waitForInput = new Runnable() {
public void run() {
while (!inputOK) {
try {
Thread.sleep(100);
} catch (Exception e) {}
}
if (!ret_val.equals("")) {
port = ret_val;
}
inputOK = false;
ret_val = "";
}
};
Thread inputW = new Thread(waitForInput);
inputW.start();
The Thread
ends when the method run
ends. Since you have while
loop you have to force explicitly the exit condition