Hi,
i need a thread to carry out certain tasks in a loop in a QThread.
However, i must be able to stop it from my main application, is creating a class variable like "bool stop", setting it false from main application and checking in my thread loop a proper way of doing this?
In my main application, i would call wait() after setting stop to false, and then create a new thread with different initial conditions. Can i use the same instance i used before or do i have to delete the old one and create a new one (ie just call start() again)?
What is a good way to pass initial parameters to the thread? Declare member variables and set them from the constructor?
Moreover, the thread will maybe access things from my main application, so i guess i should use a mutex. Is it right to declare the mutex in the class from where i call the new thread and then passing it to the new thread so both threads can lock/unlock it?
Lots of questions, i hope for lots of answers thank you in advance
Bookmarks