check if the previous task is finished before reseting the task .
if the previous task is not finished may lead to inconsistant task state.
Change-Id: I934636745fcc87474d511eaa1c7f9a44027f8d60
}
_cv.notify_one();
}
- VRle &get()
+ void wait()
{
- if (!_pending) return _rle;
+ if (!_pending) return;
+
+ {
+ std::unique_lock<std::mutex> lock(_mutex);
+ while (!_ready) _cv.wait(lock);
+ }
- std::unique_lock<std::mutex> lock(_mutex);
- while (!_ready) _cv.wait(lock);
_pending = false;
+ }
+
+ VRle &get()
+ {
+ wait();
return _rle;
}
void reset()
{
+ wait();
_ready = false;
_pending = true;
}