Ejemplo n.º 1
0
 ~ThermalScannerApp()
 {
   if(1) {
     sf::Lock isRunningMutexLock(isRunningMutex);
     isRunning = false;
   }
   scannerThread.wait();
   httpdThread.wait();
   wsdThread.terminate();
 }
Ejemplo n.º 2
0
void FeVideoImp::stop()
{
	if ( run_video_thread )
	{
		run_video_thread = false;
		m_video_thread.wait();
	}

	FeBaseStream::stop();
}
Ejemplo n.º 3
0
  ThermalScannerApp()
    : readingsTree(
        0.0, 0.0, 360.0, thermalObservedPitchRange, 4
      )
    , scannerThread(&ThermalScannerApp::scannerThreadFunc, this)
    , httpdThread(&ThermalScannerApp::httpdThreadFunc, this)
    , wsdThread(&ThermalScannerApp::wsdThreadFunc, this)
  {
    isRunning = true;

    viewPitch = thermalViewPitchRange/2.0;
    viewYaw = 180.0;
    isViewLockedToDeviceOrientation = false;

    prevThermalUpdateTime = 0.0;

    viewImage.create(windowWidth, windowHeight);

    for(int i = 0; i < 0; i++) {
      RectTree<SensorReading>::Rect rect(
        (double)rand()/(double)RAND_MAX*360.0,
        (double)rand()/(double)RAND_MAX*thermalObservedPitchRange,
        (double)rand()/(double)RAND_MAX*50.0,
        (double)rand()/(double)RAND_MAX*50.0,
        SensorReading((double)rand()/(double)RAND_MAX*30.0, 5)
      );
      readingsTree.add(rect);
    }

    if(!font.loadFromFile("Arial Black.ttf")) {
      throw std::runtime_error("Unable to load font!");
    }

    sensorUpdateDelay = 35;
    scannerThread.launch();

    httpdThread.launch();

    //wsdThread.launch();
    wsdThread.launch();
  }
Ejemplo n.º 4
0
		/// starts the thread.
		void start()
		{
			if(!m_isRunning)
			{
				m_isRunning = true;
				std::cout << "Started thread " << m_name << std::endl;
				m_thread.launch();
			}
			else
				std::cout << "WARNING: AThread::run: already running "
					<< m_name << std::endl;
		}
Ejemplo n.º 5
0
void FeVideoImp::play()
{
	run_video_thread = true;
	video_timer.restart();
	m_video_thread.launch();
}
Ejemplo n.º 6
0
		/// Terminates the thread BUT without any warranty
		/// about the state of work data
		void terminate()
		{
			m_thread.terminate();
			m_isRunning = false;
		}
Ejemplo n.º 7
0
		/// Blocks and wait until the thread ends
		void wait()
		{
			std::cout << "Waiting for thread " << m_name << " to finish..." << std::endl;
			m_thread.wait();
		}