diff options
author | Vishal Bhoj <vishal.bhoj@linaro.org> | 2012-01-31 22:29:32 +0530 |
---|---|---|
committer | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2012-03-29 09:41:16 +0200 |
commit | 619ec06acb242383ca462a88d4bb09748e72fa44 (patch) | |
tree | d802514cb40a08e25a7c9455d1d96114d6656fda | |
parent | 99d7c50e8697e81fbb35bff2b0b9da1f8f327ea7 (diff) | |
download | base-619ec06acb242383ca462a88d4bb09748e72fa44.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.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 52d9bf355f47..7d04f36854db 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -906,6 +906,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; |