Improve CFileDvdRequest::PostCancelRequest

Do nothing if either m_complete or m_cancel is set, avoiding waiting for the mutex for no reason.
This commit is contained in:
Henrique Gemignani Passos Lima 2021-04-03 19:59:50 +03:00
parent b5378e9361
commit eed6022a15
1 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,9 @@ public:
}
bool IsComplete() override { return m_complete.load(); }
void PostCancelRequest() override {
if (m_complete.load() || m_cancel.load()) {
return;
}
std::unique_lock waitlk{CDvdFile::m_WaitMutex};
m_cancel.store(true);
}