Hello all,
gotta question:
i've started my thread, everything's great. Now I'd like to end it. Calling exit() exits the threads event loop. I assume it does so immediately. But in order to make sure that my thread really has finished, I'll need to do something like the following:
Thus I have a function that will wait until run() is finished. Question: does it work that way? That is, does wait() wait for event loop to exit (in which case the above doesn't work) or does it wait for run() to exit?Qt Code:
int BaseDevice::stopThread () { quit(); if(wait ( interval() )) ;//ok else{ log("stopThread() timed out", _TIMEOUT_ERROR); //terminate(); //dangerous } return 0; }To copy to clipboard, switch view to plain text mode
thanks
K
Bookmarks