Before using condition variable, we should lock the mutex to avoid
a timing issue.
Change-Id: I78c22d275a3dfc08087ec722cb9d0c53d08c3c19
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
(cherry picked from commit
6433da6a2005ab739e9672ea0ec1532b37f95ff9)
void CynaraThread::Dispose() {
if (disposed_) return;
- done_ = true;
- cond_var_.notify_one();
+ {
+ std::lock_guard<std::mutex> lock(mutex_);
+ done_ = true;
+ cond_var_.notify_one();
+ }
thread_.join();
disposed_ = true;
}