bool DepthCamera::start() { if (isRunning()) { logger(LOG_ERROR) << "DepthCamera: Camera is already running. Please stop it before calling start() again." << std::endl; return false; } wait(); if (_captureThread && _captureThread->joinable()) { logger(LOG_ERROR) << "DepthCamera: Camera is still running. Please wait for the current capture loop to complete before calling start() again." << std::endl; return false; } if(!_callBackTypesRegistered) { logger(LOG_ERROR) << "DepthCamera: Please register a callback to " << _id << " before starting capture" << std::endl; return false; } resetFilters(); if(!_start()) return false; _running = true; _isPaused = false; //_captureThreadWrapper(); _captureThread = ThreadPtr(new Thread(&DepthCamera::_captureThreadWrapper, this)); return true; }
void GraphOracle::query_best_connection(std::shared_ptr<std::vector<SongId> > ids) { MultipleGraphOracleQuery query(ids); prune_threads(); threads_.push_back(ThreadPtr(new boost::thread(query))); }
void Client::send_request(const Request& req) { ClientQuery query(*this, req); prune_threads(); threads_.push_back(ThreadPtr(new boost::thread(query))); }
ThreadPool::ThreadPool(ThreadRoutine r, size_t poolSize) { for(size_t i = 0; i != poolSize; ++i) { m_pool.push_back(ThreadPtr(new Thread(r))); } }
void GraphOracle::query_best_connection(SongId id) { // THIS IS CROWDTAP SPECIFIC CODE TO BE REPLACED SongId other_id = PlayManager::instance().now_playing()->song().id(); GraphNodeFactory::instance().add_pair_request(PairRequest(id, other_id)); return; // THIS IS DUMMY CODE TO BE REPLACED other_id = SongFactory::instance().get_random_song_id(); while (other_id == id || (GraphNodeFactory::instance().song_map().find( other_id) == GraphNodeFactory::instance().song_map().end())) { other_id = SongFactory::instance().get_random_song_id(); } GraphNodeFactory::instance().add_pair_request(PairRequest(id, other_id)); return; // BEGIN ACTUAL CODE!!! SingleGraphOracleQuery query(id); prune_threads(); threads_.push_back(ThreadPtr(new boost::thread(query))); }
void GPUERT::runBuildProcess(int devId, int trees, BarrierPtr bar){ m_numTrees = trees; m_devId = devId; m_version = 3; m_bar = bar; m_thread = ThreadPtr(new boost::thread(boost::bind(&GPUERT::deviceHandler,this))); }
void Editor::start() { if(!_drawThread) { _drawThread = ThreadPtr(new std::thread(&Editor::drawThread, this)); } else { std::cerr << "Thread already running" << std::endl; } }
/** * \brief Construct a guider from */ CalibrationProcess::CalibrationProcess(Guider& _guider, TrackerPtr _tracker, persistence::Database _database) : GuidingProcess(_guider, _tracker, _database) { debug(LOG_DEBUG, DEBUG_LOG, 0, "construct a new calibration process"); _focallength = 0.600; _pixelsize = 0.000010; calibrated = false; _progress = 0; // create the thread thread(ThreadPtr(new astro::thread::Thread<CalibrationProcess>(*this))); debug(LOG_DEBUG, DEBUG_LOG, 0, "thread constructed"); }
void TimerMonitor::monitorBegin(TimerPtr timer) { AutoRecursiveLock lock(mLock); if (!mThread) { mThread = ThreadPtr(new boost::thread(boost::ref(*getTimerMonitor().get()))); } PUID timerID = timer->getID(); mMonitoredTimers[timerID] = TimerWeakPtr(timer); wakeUp(); }
TCPServer::TCPServer(const std::string &host, unsigned short port, unsigned threadCount, unsigned maxConnectCount, IClientFactoryPtr factory) : Socket(stTCP) , IsRun(true) , Factory(factory) , MaxConnectCount(maxConnectCount) { Bind(host.c_str(), port); Listen(); ClientsEvent.Reset(); ListenThread.reset(new System::Thread(Common::CreateMemberCallback(*this, &TCPServer::Listener))); for (unsigned i = 0 ; i < threadCount ; ++i) WorkingThreads.push_back(ThreadPtr(new System::Thread(Common::CreateMemberCallback(*this, &TCPServer::ProcessClients)))); }
void ServerSocket::start() { std::cout << "#ServerSocket: Launching thread" << std::endl; socket_thread = ThreadPtr(new std::thread(&ServerSocket::service, this)); }
void MainFramework::run(){ if(!m_messageParser) m_messageParser = ThreadPtr(new boost::thread(&MainFramework::parseMessages,this)); }
void runTests( RCF::RcfServer &server, RCF::I_ClientTransport & clientTransport, int concurrencyCount, unsigned int clientReps, unsigned int maxDelayMs = 0) { // now try a more realistic load test boost::shared_ptr<util::ImmediateProfile> immmediateProfilePtr; // bind I_X X x; server.bind( (I_X*) 0, x); // bind I_Y to object factory RCF::ObjectFactoryServicePtr objectFactoryServicePtr( new RCF::ObjectFactoryService(10, 60)); objectFactoryServicePtr->bind( (I_Y*) 0, (Y**) 0); server.addService( RCF::ServicePtr(objectFactoryServicePtr)); server.start(); ThreadGroup threadGroup; // calls to I_X { util::ImmediateProfile profile("load test: all clients making static object calls"); for (int i=0; i<concurrencyCount; ++i) { threadGroup.push_back( ThreadPtr( new Thread( boost::bind( clientLoadTest, boost::ref(clientTransport), clientReps, maxDelayMs)))); } joinThreadGroup(threadGroup); } // calls to I_Y threadGroup.clear(); { util::ImmediateProfile profile("load test: all clients making dynamic object calls"); for (int i=0;i<concurrencyCount; ++i) { threadGroup.push_back( ThreadPtr( new Thread( boost::bind( clientObjectLoadTest, boost::ref(clientTransport), clientReps, maxDelayMs)))); } joinThreadGroup(threadGroup); } // mixed threadGroup.clear(); { util::ImmediateProfile profile("load test: half/half clients making static/dynamic object calls"); for (int i=0; i<concurrencyCount; ++i) { switch(i%2) { case 0: threadGroup.push_back( ThreadPtr( new Thread( boost::bind( clientLoadTest, boost::ref(clientTransport), clientReps, maxDelayMs)))); break; case 1: threadGroup.push_back( ThreadPtr( new Thread( boost::bind( clientObjectLoadTest, boost::ref(clientTransport), clientReps, maxDelayMs)))); break; default: RCF_ASSERT(0); } } joinThreadGroup(threadGroup); } server.stop(); }
Thread::ThreadPtr Thread::create() { return ThreadPtr(new Thread); }
LoadThread::LoadThread(xtal::AnyPtr load_list) { AnyPtrToVector_LoadItem(load_list); ThisThread=ThreadPtr( new boost::thread(&LoadThread::DataLoad,&(*this)) ); }