Problem for While(true) in QT QThread Run function
Unsolved
General and Desktop
-
Hi,
All,
I created one thread, and the run function looks like below:
void Compass_Message_Handler::run() { this->handleMessage(); return; } void Compass_Message_Handler::handleMessage() { while(true) { if(m_canHandleNxtMsg)//line A { //////////////////////////////////// ///////////////////////////////////////////////// } } }
I set a break point at line A. but i find that after several execution, i need to wait for 3 to 5 seconds for the while to run again to the break point line A.
Do you know why, is it because multi thread and the cpu need to run other thread??????
[Fixed code formatting ~kshegunov]
-
welcome to the forum. I don't see any issue with your code. Do you see the same behaviour when you run the above program without break point ? What are you doing inside the if condition ?
-
Hi,
Dheerendra,
Thanks for your answer, i still not check if i run not in debug mode.
I will check it ,thanks.
-
@dheerendra Asked what you are doing inside that if() condition. Is it something long lasting?