Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6a975ee authored by sangweilin's avatar sangweilin Committed by Automerger Merge Worker
Browse files

catch mutex when notify sampling rate changed, otherwise signal may be lost...

catch mutex when notify sampling rate changed, otherwise signal may be lost am: e1e361ed am: ab8e9f1b

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2496635



Change-Id: I5a0567009ee8e9c6ae792888ea9992f6d2ea1442
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents ffbbc410 ab8e9f1b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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