summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.h
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-11-14 20:55:25 -0800
committerMathias Agopian <mathias@google.com>2012-06-27 17:07:54 -0700
commit71d7a5c289c6ef6b5fc86dd4784a075ca6470e38 (patch)
tree0179f726357ef2daa400e207dbc56c0576a81c52 /services/sensorservice/SensorService.h
parent94e8f6813f3fb2beaa9bcbfb1ad9b4ae2eb46949 (diff)
downloadframeworks_native-71d7a5c289c6ef6b5fc86dd4784a075ca6470e38.zip
frameworks_native-71d7a5c289c6ef6b5fc86dd4784a075ca6470e38.tar.gz
frameworks_native-71d7a5c289c6ef6b5fc86dd4784a075ca6470e38.tar.bz2
Fix a race condition in sensormanager
the per-connection state assumed the main sensorservice lock was held during access. This is however not true while pre-processing the events just before sending them to clients. Therefore, there was a small window during which this state could be modified while being used. we now have an internal lock that protects this state. Change-Id: I594680f20f09d6a4f1f38f093a1d3f650dcef1be
Diffstat (limited to 'services/sensorservice/SensorService.h')
-rw-r--r--services/sensorservice/SensorService.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h
index b442779..c0922f5 100644
--- a/services/sensorservice/SensorService.h
+++ b/services/sensorservice/SensorService.h
@@ -75,8 +75,9 @@ class SensorService :
sp<SensorService> const mService;
sp<SensorChannel> const mChannel;
+ mutable Mutex mConnectionLock;
- // protected by SensorService::mLock
+ // protected mConnectionLock
struct SensorInfo {
SensorInfo() : ns(DEFAULT_EVENTS_PERIOD) { }
nsecs_t ns;