HeadSetDetect::~HeadSetDetect() { SXLOGV("+deconstruct"); stop(); requestExitAndWait(); SXLOGV("-deconstruct"); }
void AudioPlayer::playFile(struct FileMap* fileMap) { // stop any currently playing sound requestExitAndWait(); mCurrentFile = fileMap; run("bootanim audio", PRIORITY_URGENT_AUDIO); }
void AudioPolicyService::AudioCommandThread::exit() { LOGV("AudioCommandThread::exit"); { AutoMutex _l(mLock); requestExit(); mWaitWorkCV.signal(); } requestExitAndWait(); }
void Exit() { { Mutex::Autolock _l(m_LockCondition); LOGI("[VTMAL][SendThread]@Thread Exit--start"); requestExit(); LOGI("[VTMAL][SendThread]@Thread Exit--end"); m_sentSignal = true; mWaitWork.signal(); } requestExitAndWait(); LOGI("[VTMAL][SendThread]@Thread Exit--real exit"); }
status_t LivePhotoSource::stop() { ALOGD("+"); bool bStopSource = false; { Mutex::Autolock _lock(mLock); if(mSourceStarted && !mLivePhotoStarted) { bStopSource = true; mSourceStarted = false; ALOGD("signal to stop writer read"); mFrameAvailableCond.signal(); //mWriterReadEndCond.wait(mLock); } else if(mLivePhotoStarted) { ALOGD("wait writer read end"); mWriterReadEndCond.wait(mLock); } } status_t err = OK; if(bStopSource) { { Mutex::Autolock _lock(mLock); if(mIsThreadExit) { ALOGD("thread exited, no need wait"); } else { ALOGD("wait thread exit"); mThreadExitCond.wait(mLock); } } requestExit(); requestExitAndWait(); if(mSource != NULL) { ALOGD("mSource stop()"); err = mSource->stop(); } } ALOGD("-"); return err; }
status_t LivePhotoSource::startLivePhoto() { ALOGD("+"); bool bStopSource = false; { Mutex::Autolock _lock(mLock); if(mSourceStarted && !mLivePhotoStarted) { bStopSource = true; mLivePhotoStarted = true; //mSourceStarted = false; // move before source stop()?? ALOGD("wait read source end"); } else if(mLivePhotoStarted) { ALOGD("live photo has been started"); return OK; } else return UNKNOWN_ERROR; } status_t err = OK; if(bStopSource) { { Mutex::Autolock _lock(mLock); ALOGD("wait thread exit"); mThreadExitCond.wait(mLock); } requestExit(); requestExitAndWait(); if(mSource != NULL) { ALOGD("mSource stop()"); err = mSource->stop(); } } ALOGD("-"); return err; }
status_t EmulatedCameraDevice::WorkerThread::stopThread() { ALOGV("Stopping emulated camera device's worker thread..."); status_t res = EINVAL; if (mThreadControl >= 0) { /* Send "stop" message to the thread loop. */ const ControlMessage msg = THREAD_STOP; const int wres = TEMP_FAILURE_RETRY(write(mThreadControl, &msg, sizeof(msg))); if (wres == sizeof(msg)) { /* Stop the thread, and wait till it's terminated. */ res = requestExitAndWait(); if (res == NO_ERROR) { /* Close control FDs. */ if (mThreadControl >= 0) { close(mThreadControl); mThreadControl = -1; } if (mControlFD >= 0) { close(mControlFD); mControlFD = -1; } ALOGV("Emulated camera device's worker thread has been stopped."); } else { ALOGE("%s: requestExitAndWait failed: %d -> %s", __FUNCTION__, res, strerror(-res)); } } else { ALOGE("%s: Unable to send THREAD_STOP message: %d -> %s", __FUNCTION__, errno, strerror(errno)); res = errno ? errno : EINVAL; } } else { ALOGE("%s: Thread control FDs are not opened", __FUNCTION__); } return res; }
CameraAcc::~CameraAcc() { LOG1("@%s", __FUNCTION__); requestExitAndWait(); }
status_t JpegCompressor::cancel() { requestExitAndWait(); return OK; }
void BufferProducerThread::shutdown() { Mutex::Autolock autoLock(&mLock); mShutdown = true; setSurfaceLocked(NULL); requestExitAndWait(); }