//--------------------------------------------------------------- void threadedEncoding::threadedFunction(){ if(lock()){ encode(fileName, audioFileName, frameRate,compression,exportAudio); unlock(); } stopThread(); }
bool Camera::close() { stopThread(); // for some reason waiting for the thread keeps it from // completing, but sleeping then stopping capture is ok. ofSleepMillis(100); stopCapture(); }
// ---------------------------------------------------------------------------- void ofOpenALSoundPlayer::stop(){ alSourceStopv(channels,&sources[sources.size()-channels]); if(isStreaming){ setPosition(0); stopThread(); } }
// the principal program sequence void VisionEngine::start() { if (!interface_) interface_ = new ConsoleInterface(app_name_.c_str()); if (!interface_->openDisplay(this)) { delete interface_; interface_ = new ConsoleInterface(app_name_.c_str()); interface_->openDisplay(this); } if(camera_==NULL ) { interface_->displayError("No camera found!"); return; } if( camera_->startCamera() ) { initFrameProcessors(); startThread(); mainLoop(); stopThread(); } else interface_->displayError("Could not start camera!"); teardownCamera(); freeBuffers(); }
//-------------------------------------------------------------- // Stops the client thread. You don't really need to do this ever. //-------------------------------------------------------------- void mpeClientTCP::stop() { out("Quitting."); stopThread(); if(useMainThread){ ofRemoveListener(ofEvents.draw, this, &mpeClientTCP::draw); } }
//-------------------------------------------------------------- // Stops the client thread. You don't really need to do this ever. //-------------------------------------------------------------- void ofxMPEClient::stop() { log("Quitting."); stopThread(); if(useMainThread){ ofRemoveListener(ofEvents().draw, this, &ofxMPEClient::draw); } }
//------------------------------------------------- void ofThread::waitForThread(bool callStopThread, long milliseconds){ if(!threadDone){ // tell thread to stop if(callStopThread){ stopThread(); } // wait for the thread to finish if(isCurrentThread()){ return; // waitForThread should only be called outside thread } if (INFINITE_JOIN_TIMEOUT == milliseconds){ if(thread.joinable()){ try{ thread.join(); }catch(...){} } }else{ // Wait for "joinWaitMillis" milliseconds for thread to finish std::unique_lock<std::mutex> lck(mutex); if(!threadDone && condition.wait_for(lck,std::chrono::milliseconds(milliseconds))==std::cv_status::timeout){ // unable to completely wait for thread } } } }
void Renderinstance::shutdownRenderer() { stopThread(); if (m_pRenderer!=0) delete m_pRenderer; m_pRenderer=0; if ((m_pScene!=0) && (m_pScene!=m_pTestscene)) delete m_pScene; m_pScene=0; if (m_pTestscene!=0) delete m_pTestscene; m_pTestscene=0; }
// ---------------------------------------------------------------------------- // Stop the thread and DMX interface // DMX_STATUS AbstractDMXDriver::stop() { if ( !stopThread() ) return DMX_ERROR; // Disconnect interface return dmx_close(); }
//-------------------------------------------------------------- void threadedClock::stop() { // Stop thread stopThread(); }
//------------------------------------------------- void ofThread::waitForThread(bool callStopThread, long milliseconds){ if(thread.isRunning()){ threadBeingWaitedFor = true; // tell thread to stop if(callStopThread){ stopThread(); ofLogVerbose("ofThread") << "- name: " << getThreadName() << " - Signaled to stop."; } // wait for the thread to finish ofLogVerbose("ofThread") << "- name: " << getThreadName() << " - waiting to stop"; if(isCurrentThread()){ ofLogWarning("ofThread") << "- name: " << getThreadName() << " - waitForThread should only be called from outside the this ofThread."; return; } if (INFINITE_JOIN_TIMEOUT == milliseconds){ thread.join(); }else{ // Wait for "joinWaitMillis" milliseconds for thread to finish if(!thread.tryJoin(milliseconds)){ ofLogError("ofThread") << "- name: " << getThreadName() << " - Unable to completely waitForThread."; } } } }
ofxPixelPusherUnit::~ofxPixelPusherUnit() { stopThread(); while (isThreadRunning()) ; udp.Close(); }
void ofxColorStream::exit() { stopThread(); waitForThread(); stream->stop(); stream->destroy(); }
void close() { stop(); stopThread (6000); deviceOpen = false; recorder = nullptr; player = nullptr; }
//-------------------------------------------------------------- void Reactor::exit(){ if (context != NULL) { stopThread(); libwebsocket_context_destroy(context); context = NULL; } }
//------------------------------------------------------------------- void pbOscReceiver::close() { _cb = 0; if ( _threaded ) { stopThread(); //TODO - it crashes application! } //oscReceiver.close(); }
NMListener::~NMListener() { DBG(__func__ << ": cleanup thread"); if (isThreadRunning()) { signalThreadShouldExit(); notify(); stopThread(2000); } }
// ---------------------------------------------------------------------------- // bool AnimationTask::stop() { clearAnimations(); if ( !stopThread() ) return false; return true; }
void CryptobullionApplication::startThread() { coreThread = new QThread(this); CryptobullionCore *executor = new CryptobullionCore(); executor->moveToThread(coreThread); /* communication to and from thread */ connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int))); connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int))); connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString))); connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize())); connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown())); /* make sure executor object is deleted in its own thread */ connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater())); connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit())); coreThread->start(); }
void SpeechSystem::destroy() { if (verbose) printf("SpeechSystem::destroy()\n"); /* calling j_close_stream(recog) at any time will terminate recognition and exit j_recognize_stream() */ j_close_stream(recog); stopThread(); }
SoundBuffer::~SoundBuffer() { stopThread(); delete m_nextBufferSegmentFillRequest; delete m_nextBufferSegmentFillCompleted; delete m_updatingStream; }
// ---------------------------------------------------------------------------- void ofOpenALSoundPlayer::stop(){ if(sources.empty()) return; std::unique_lock<std::mutex> lock(mutex); alSourceStopv(channels,&sources[sources.size()-channels]); if(isStreaming){ setPosition(0); stopThread(); } }
void ListFileProvider::refresh() { stopThread(); clearItems(); if ( !paths_.empty() ) startThread(); }
bool ofxNetworkSyncClientState::close(){ if(isThreadRunning()){ stopThread(); waitForThread(); } calibrator.close(); server = NULL; tcpServer = NULL; }
void ofxPS3EyeGrabber::stop() { stopThread(); if (_cam) { _cam->stop(); } }
//--------------------------------------------------------------------------- void ofxKinect::close(){ if(isThreadRunning()){ stopThread(); } usleep(500000); // some time while thread is stopping ... //libusb_exit(NULL); }
ofxTCPSyncClient::~ofxTCPSyncClient() { stopThread(); if(bTCP) tcpClient.close(); else{ udpSender.Close(); udpReceiver.Close(); } }
void close() { if (isRunning) { stopThread (2000); isRunning = false; closeDevices(); } }
void ofxMSAThreadedImageSaver::threadedFunction() { if(lock()) { saveImage(fileName); unlock(); } else { printf("ofxMSAThreadedImageSaver - cannot save %s cos I'm locked", fileName.c_str()); } stopThread(); }
threadedSerial::~threadedSerial() { if( isThreadRunning() ) { stopThread(); } // oscSender.clear(); }