summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2012-01-31 22:29:32 +0530
committerVishal Bhoj <vishal.bhoj@linaro.org>2012-01-31 22:29:41 +0530
commit960ea274d0355bb144558e1176a4597f00bbbde4 (patch)
tree894706ec921b1e1edbea7324a2cee501fed2b6d1
parent6b27f9dc3adfe8657f5c5510e64858813342515a (diff)
downloadbase-960ea274d0355bb144558e1176a4597f00bbbde4.tar.gz
camera: merged http://review.omapzoom.org/#change,14346 to
fix race condition while image capture Change-Id: I56d11ea05ecf969d8dbb6f65451884a1f9c3ed02 Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rw-r--r--services/camera/libcameraservice/CameraService.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index bb0e66463835..c331e78ae9b1 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -916,6 +916,12 @@ bool CameraService::Client::lockIfMessageWanted(int32_t msgType) {
LOG1("lockIfMessageWanted(%d): enter sleep", msgType);
}
usleep(CHECK_MESSAGE_INTERVAL * 1000);
+ // Return true after 100ms. We don't want to enter in an infinite loop.
+ if (sleepCount == 10) {
+ LOGE("lockIfMessageWanted(%d): timed out in %d ms",
+ msgType, sleepCount * CHECK_MESSAGE_INTERVAL);
+ return true;
+ }
}
LOGW("lockIfMessageWanted(%d): dropped unwanted message", msgType);
return false;