prcsThread->setChildData(data_child);
It is just the replacement of your code
prcsThread->run(data_child);
You are calling run function with some arguments.
In case of QThread run() is the virtual function which we reimplement in our derived class.
so on calling start function run will autometically executed.
The implementation of run() in thread should be without parameters.
rcvThread
->start
(QThread::HighestPriority);
rcvThread->start(QThread::HighestPriority);
To copy to clipboard, switch view to plain text mode
ex
{
myThread() {}
void setChildData(YourDataType value) {
value_ = value
}
protected:
void run()
{
// DO SOMETHING
}
private:
yourDataType value_;
};
class myThread : public QThread
{
myThread() {}
void setChildData(YourDataType value) {
value_ = value
}
protected:
void run()
{
// DO SOMETHING
}
private:
yourDataType value_;
};
To copy to clipboard, switch view to plain text mode
you can use this thread
int myValue_say = 5;
myThread *thread = new myThread();
thread->setChildData(myValue_say);
thread
->start
(QThread::HighestPriority);
int myValue_say = 5;
myThread *thread = new myThread();
thread->setChildData(myValue_say);
thread->start(QThread::HighestPriority);
To copy to clipboard, switch view to plain text mode
For more basic info about QThread:
http://qt-project.org/doc/qt-4.8/threads-starting.html
Bookmarks