MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / stop

Method stop

framework/utils/afThread.cpp:160–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void afThread::stop()
161{
162 AF_LOGD("%s:%d(%s) %s \n", __FILE__, __LINE__, __func__, mName.c_str());
163 std::lock_guard<std::mutex> guard(mMutex);
164 mTryPaused = false;
165 {
166 std::unique_lock<std::mutex> sleepMutex(mSleepMutex);
167 mThreadStatus = THREAD_STATUS_STOPPED;
168 }
169 mSleepCondition.notify_one();
170
171 if (mThreadPtr && mThreadPtr->joinable()) {
172 if (mThreadPtr->get_id() != std::this_thread::get_id()) {
173 mThreadPtr->join();
174 } else {
175 mThreadPtr->detach();
176 }
177 }
178
179 delete mThreadPtr;
180 mThreadPtr = nullptr;
181 AF_LOGD("%s:%d(%s) %s \n", __FILE__, __LINE__, __func__, mName.c_str());
182}
183
184void afThread::forceStop()
185{

Callers

nothing calls this directly

Calls 1

detachMethod · 0.80

Tested by

no test coverage detected