diff --git a/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp b/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp index a0bb67a3f9..d8e292a0da 100644 --- a/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp +++ b/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp @@ -76,6 +76,7 @@ void Sensor::batch(int64_t samplingPeriodNs) { static_cast(mSensorInfo.minDelay) * 1000, static_cast(mSensorInfo.maxDelay) * 1000); + std::unique_lock lock(mRunMutex); if (mSamplingPeriodNs != samplingPeriodNs) { mSamplingPeriodNs = samplingPeriodNs; // Wake up the 'run' thread to check if a new event should be generated now