zhongzhu
21st October 2009, 14:19
I create another thread from main GUI thread and let the thread to do some background work but sometimes the new thread will be blocked/just dead in the run() before the "if (!stop)"
void MyClass::run() {
if (!stop) {
...
someOperation(); //it's dead here, not able to use if(!stop) to quit the run() gracefully.
....
}
}
I was trying to call ptrTothread->quit(), ptrTothread->terminate(), delete ptrTothread from the main GUI thread on the new thread but not able to close it.
any ideas?
void MyClass::run() {
if (!stop) {
...
someOperation(); //it's dead here, not able to use if(!stop) to quit the run() gracefully.
....
}
}
I was trying to call ptrTothread->quit(), ptrTothread->terminate(), delete ptrTothread from the main GUI thread on the new thread but not able to close it.
any ideas?