catch mutex when notify sampling rate changed, otherwise signal may be lost am: e1e361ed43
am: ab8e9f1b2b
am: c6a975ee1f
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2496635 Change-Id: Idff71b1768fe95ff55d091b577c458f5740c2d31 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
097d2ce929
1 changed files with 1 additions and 0 deletions
|
@ -76,6 +76,7 @@ void Sensor::batch(int64_t samplingPeriodNs) {
|
||||||
static_cast<int64_t>(mSensorInfo.minDelay) * 1000,
|
static_cast<int64_t>(mSensorInfo.minDelay) * 1000,
|
||||||
static_cast<int64_t>(mSensorInfo.maxDelay) * 1000);
|
static_cast<int64_t>(mSensorInfo.maxDelay) * 1000);
|
||||||
|
|
||||||
|
std::unique_lock<std::mutex> lock(mRunMutex);
|
||||||
if (mSamplingPeriodNs != samplingPeriodNs) {
|
if (mSamplingPeriodNs != samplingPeriodNs) {
|
||||||
mSamplingPeriodNs = samplingPeriodNs;
|
mSamplingPeriodNs = samplingPeriodNs;
|
||||||
// Wake up the 'run' thread to check if a new event should be generated now
|
// Wake up the 'run' thread to check if a new event should be generated now
|
||||||
|
|
Loading…
Reference in a new issue