Example #1
0
void MapWindow::CloseDrawingThread(void)
{
#ifndef ENABLE_OPENGL
  #if TESTBENCH
  StartupStore(_T("... CloseDrawingThread started\n"));
  #endif
  CLOSETHREAD = TRUE;
  drawTriggerEvent.set(); // wake self up
  SuspendDrawingThread();

  #if TESTBENCH
  StartupStore(_T("... CloseDrawingThread waitforsingleobject\n"));
  #endif
  #ifdef __linux__
  #else
  drawTriggerEvent.reset(); // on linux this is delaying 5000
  #endif
  MapWindowThread.join();

  #if TESTBENCH
  StartupStore(_T("... CloseDrawingThread wait THREADEXIT\n"));
  #endif
  while(!THREADEXIT) { Poco::Thread::sleep(50); };
  #if TESTBENCH
  StartupStore(_T("... CloseDrawingThread finished\n"));
  #endif
#else
  CLOSETHREAD = TRUE;
  THREADEXIT = TRUE;
#endif
}
Example #2
0
// Shutdown Live Tracker
void LiveTrackerShutdown()
{
  if (_Thread.isRunning()) {
    _t_end = false;
    _t_run = false;
    NewDataEvent.set();
    _Thread.join();
    StartupStore(TEXT(". LiveTracker closed.%s"),NEWLINE);
  }
#ifdef WIN32
  if (_ws_inited) {
    WSACleanup();
  }
#endif
}
void PothosUtilBase::proxyServer(const std::string &, const std::string &uriStr)
{
    Pothos::init();

    //parse the URI
    const std::string defaultUri = "tcp://0.0.0.0:"+Pothos::RemoteServer::getLocatorPort();
    Poco::URI uri(uriStr.empty()?defaultUri:uriStr);
    const std::string &host = uri.getHost();
    const std::string &port = std::to_string(uri.getPort());
    if (uri.getScheme() != "tcp")
    {
        throw Pothos::Exception("PothosUtil::proxyServer("+uriStr+")", "unsupported URI scheme");
    }

    //create server socket
    Poco::Net::SocketAddress sa(host, port);
    Poco::Net::ServerSocket serverSocket(sa);
    Poco::Net::TCPServerConnectionFactory::Ptr factory(new MyTCPServerConnectionFactory());
    Poco::Net::TCPServer tcpServer(factory, serverSocket);

    //start the server
    std::cout << "Host: " << serverSocket.address().host().toString() << std::endl;
    std::cout << "Port: " << serverSocket.address().port() << std::endl;
    serverSocket.listen();
    tcpServer.start();

    //monitor active connections in monitor mode
    if (this->config().hasOption("requireActive"))
    {
        //create a TCP connection monitor thread
        MyTCPConnectionMonitor monitor(tcpServer);
        Poco::Thread monitorThread;
        monitorThread.start(monitor);

        //wait here until the term signal is received
        this->waitForTerminationRequest();

        //end the monitor thread
        monitor.running = false;
        monitorThread.join();
    }
    else
    {
        //wait here until the term signal is received
        this->waitForTerminationRequest();
    }
}
Example #4
0
 void FileProcessor::start() {
   Poco::Thread thread;
   thread.start(*this);
   thread.join();
 }