1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include "ThreadWorker.hpp"
void ThreadWorker::setTerminate(bool b)
{
boost::mutex::scoped_lock lock(m_mutex);
m_should_terminate=b;
};
bool ThreadWorker::shouldTerminate()
{
boost::mutex::scoped_lock lock(m_mutex);
return m_should_terminate;
};
void ThreadWorker::setProgress(float i)
{
boost::mutex::scoped_lock lock(m_mutex);
m_progress=i;
};
void ThreadWorker::setStatus(std::string s)
{
boost::mutex::scoped_lock lock(m_mutex);
m_status=s;
};
float ThreadWorker::progress()
{
boost::mutex::scoped_lock lock(m_mutex);
return m_progress;
};
std::string ThreadWorker::getStatus()
{
boost::mutex::scoped_lock lock(m_mutex);
return m_status;
};
void ThreadWorker::setReturnValue(boost::any a)
{
boost::mutex::scoped_lock lock(m_mutex);
m_val = a;
};
boost::any ThreadWorker::getReturnValue()
{
boost::mutex::scoped_lock lock(m_mutex);
return m_val;
};
bool ThreadWorker::done()
{
boost::mutex::scoped_lock lock(m_mutex);
return m_done;
};
void ThreadWorker::callSingleAction()
{
{
boost::mutex::scoped_lock lock(m_mutex);
m_done = false;
}
this->singleAction();
{
boost::mutex::scoped_lock lock(m_mutex);
m_done = true;
}
};
|