Esempio n. 1
0
void ThreadTask::run(SupervisorThread* thread)
{
  m_Mutex.lock();
  if(!m_KeepRunning)
    {
      //if this is set it means the task was requested to terminate.
      threadSupervisor->_i_finished(this);
      m_Mutex.unlock();
      return;
    }
  m_CurrentThread=thread;
  m_Started = true;
  m_Running=true;
  m_Mutex.unlock();
  m_Result = m_Func(m_UserData);
  m_Mutex.lock();
  m_Running=false;
  if(!m_KeepRunning)
    {
      m_Mutex.unlock();
      return;
    }
  m_Done = true;
  m_CurrentThread=NULL;
  threadSupervisor->_i_finished(this);
  //cancel stuff_
  for(std::set<ThreadTask*>::iterator it = m_CancelTasks.begin(); it!=m_CancelTasks.end(); ++it)
    threadSupervisor->_i_cancelTask(*it);
  //start stuff
  for(std::set<ThreadTask*>::iterator it = m_StartTasks.begin(); it!=m_StartTasks.end(); ++it)
    threadSupervisor->_i_startTask(*it,this);
  m_Mutex.unlock();
}
Esempio n. 2
0
	/* XMLObject */
	void* XMLObject::LoadXML(XMLNode node, void* theptr) {
		if (m_Func) m_Func(node, theptr);
		return theptr;
	}