Merge "Camera2: Fix a deadlock when closing the camera: DO NOT MERGE" into jb-mr1-aah-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
778dd967ad
@@ -166,22 +166,26 @@ status_t EmulatedFakeCamera2::connectCamera(hw_device_t** device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t EmulatedFakeCamera2::closeCamera() {
|
status_t EmulatedFakeCamera2::closeCamera() {
|
||||||
Mutex::Autolock l(mMutex);
|
{
|
||||||
|
Mutex::Autolock l(mMutex);
|
||||||
|
|
||||||
status_t res;
|
status_t res;
|
||||||
ALOGV("%s", __FUNCTION__);
|
ALOGV("%s", __FUNCTION__);
|
||||||
|
|
||||||
res = mSensor->shutDown();
|
res = mSensor->shutDown();
|
||||||
if (res != NO_ERROR) {
|
if (res != NO_ERROR) {
|
||||||
ALOGE("%s: Unable to shut down sensor: %d", __FUNCTION__, res);
|
ALOGE("%s: Unable to shut down sensor: %d", __FUNCTION__, res);
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
mConfigureThread->requestExit();
|
||||||
|
mReadoutThread->requestExit();
|
||||||
|
mControlThread->requestExit();
|
||||||
|
mJpegCompressor->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
mConfigureThread->requestExit();
|
// give up the lock since we will now block and the threads
|
||||||
mReadoutThread->requestExit();
|
// can call back into this object
|
||||||
mControlThread->requestExit();
|
|
||||||
mJpegCompressor->cancel();
|
|
||||||
|
|
||||||
mConfigureThread->join();
|
mConfigureThread->join();
|
||||||
mReadoutThread->join();
|
mReadoutThread->join();
|
||||||
mControlThread->join();
|
mControlThread->join();
|
||||||
|
|||||||
Reference in New Issue
Block a user