Hello,
I have never worked with QThread in Qt, or with threads in general, so the topic is more then new to me. Still I have to use QThread's in order to avoid the blocking of my main application due to some heavy computations.
So I want to put my heavy computations in a thread and if they take too much time I want to kill the thread (which was also suggested to me).
I have the following declaration for my thread:
class myopThread : public QThread
{
public:
void run();
};
void myopThread::run()
{
std::cout<<"here in the thread. Are you working?"<<endl;
//include all the consuming operations here
exec();
}
I also start the thread in my main application:
myopThread *t=new myopThread;
t->start();
It seems to work. Still now I would want to kill this thread whenever the computing time of the operations in run() is greater then 2 minutes let's say.
I do not know how to implement this. Any help is more then welcomed.
Thank you in advance, madalina