lamm
24th March 2010, 16:51
Hello, I am new in this forum, and I am very enthusiastic about Qt.
However, I have the following problem. Since I understand that there is no built-in facility to check for input on stdin, I wrote a thread for it. This works fine, but after program termination the error message
"QThread: Destroyed while thread is still running" appears.
In this thread I wrote this simple run function:
void InputThread::run()
{ fgets(inputLine, 200, stdin);
}
Since the input data read from stdin, if available, starts with 'x', I test whether input is available as follows:
if (inputThread->inputLine[0] == 'x') ... // input available in inputLine
It looks like, due to the fgets input command, the thread keeps running, despite my attempts to stop it by calling inputThread.exit() or inputThread.quit.
Can anyone please help? Any solution for checking if stdin input is available is welcome, provided it works on both Linux and Windows.
However, I have the following problem. Since I understand that there is no built-in facility to check for input on stdin, I wrote a thread for it. This works fine, but after program termination the error message
"QThread: Destroyed while thread is still running" appears.
In this thread I wrote this simple run function:
void InputThread::run()
{ fgets(inputLine, 200, stdin);
}
Since the input data read from stdin, if available, starts with 'x', I test whether input is available as follows:
if (inputThread->inputLine[0] == 'x') ... // input available in inputLine
It looks like, due to the fgets input command, the thread keeps running, despite my attempts to stop it by calling inputThread.exit() or inputThread.quit.
Can anyone please help? Any solution for checking if stdin input is available is welcome, provided it works on both Linux and Windows.