mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 21:37:44 +00:00
catch mutex when notify sampling rate changed, otherwise signal may be lost
Change-Id: Ib52f26e731808ecbe5fd2a53fcd8a47ab3882902 Signed-off-by: sangweilin <sangweilin@xiaomi.com>
This commit is contained in:
@@ -76,6 +76,7 @@ void Sensor::batch(int64_t samplingPeriodNs) {
|
||||
static_cast<int64_t>(mSensorInfo.minDelay) * 1000,
|
||||
static_cast<int64_t>(mSensorInfo.maxDelay) * 1000);
|
||||
|
||||
std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
if (mSamplingPeriodNs != samplingPeriodNs) {
|
||||
mSamplingPeriodNs = samplingPeriodNs;
|
||||
// Wake up the 'run' thread to check if a new event should be generated now
|
||||
|
||||
Reference in New Issue
Block a user