Added a SensorEventQueue, a circular buffer meant for reading with one thread
and polling a subhal with another. The writing thread gets access to pointers
in the internal buffer. This design avoids a memcpy on write when the multihal
fetches subhal events using poll().
Unit-tests include multithreaded reading and writing lots of events, in
random-sized chunks.
This is not used by the multihal yet. That will be a different CL.
Change-Id: I58418d69eebebeb96befb08ba3aed080f0f08551
diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk
index 6298ca0..5b787d4 100644
--- a/modules/sensors/Android.mk
+++ b/modules/sensors/Android.mk
@@ -14,10 +14,10 @@
# limitations under the License.
#
-ifeq ($(USE_SENSOR_MULTI_HAL),true)
-
LOCAL_PATH := $(call my-dir)
+ifeq ($(USE_SENSOR_MULTI_HAL),true)
+
include $(CLEAR_VARS)
LOCAL_MODULE := sensors.$(TARGET_DEVICE)
@@ -25,24 +25,28 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_CFLAGS := -DLOG_TAG=\"MultiHal\"
-LOCAL_SRC_FILES := multihal.cpp
+
+LOCAL_SRC_FILES := \
+ multihal.cpp \
+ SensorEventQueue.h \
+ SensorEventQueue.cpp \
LOCAL_SHARED_LIBRARIES := \
- liblog \
libcutils \
libdl \
+ liblog \
libstlport \
libutils \
- libcutils \
- liblog \
LOCAL_PRELINK_MODULE := false
LOCAL_STRIP_MODULE := false
LOCAL_C_INCLUDES := \
external/stlport/stlport \
- bionic /
+ bionic \
include $(BUILD_SHARED_LIBRARY)
endif # USE_SENSOR_MULTI_HAL
+
+include $(call all-subdir-makefiles)