mirror of
https://github.com/Evolution-X-Devices/device_motorola_rtwo
synced 2026-01-27 13:35:15 +00:00
dubai: sensors: Fix locking around setOperationMode and activate
Change-Id: I9a09f45f012662c8f92fa40da3a4b9dd691a1b2c
This commit is contained in:
committed by
Marc Bourgoin
parent
6fed258d33
commit
2a89cd587a
@@ -83,8 +83,8 @@ void Sensor::batch(int32_t samplingPeriodNs) {
|
||||
}
|
||||
|
||||
void Sensor::activate(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mRunMutex);
|
||||
if (mIsEnabled != enable) {
|
||||
std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
mIsEnabled = enable;
|
||||
mWaitCV.notify_all();
|
||||
}
|
||||
@@ -158,8 +158,8 @@ std::vector<Event> Sensor::readEvents() {
|
||||
}
|
||||
|
||||
void Sensor::setOperationMode(OperationMode mode) {
|
||||
std::lock_guard<std::mutex> lock(mRunMutex);
|
||||
if (mMode != mode) {
|
||||
std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
mMode = mode;
|
||||
mWaitCV.notify_all();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user