2013-10-20 12:53:53 +00:00
|
|
|
#include "Thread.h"
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
Thread::Thread(ThreadFunction function) : data(0), result(0), function(function) {
|
2013-10-20 12:53:53 +00:00
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
void Thread::start(void *data) {
|
2013-10-20 12:53:53 +00:00
|
|
|
this->data = data;
|
|
|
|
QThread::start();
|
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
void *Thread::join() {
|
2013-10-20 12:53:53 +00:00
|
|
|
QThread::wait();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
void Thread::run() {
|
2013-10-20 12:53:53 +00:00
|
|
|
result = function(data);
|
|
|
|
}
|