Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd2e388b authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Functions called by RequestThread::threadLoop must not hold...

Merge "Functions called by RequestThread::threadLoop must not hold mInterfaceMutex." am: 2638df9b am: 12638d3b

Change-Id: I0993e9e07e212773a92aade3148d1462aab4bfe1
parents cb257970 12638d3b
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -2165,7 +2165,9 @@ void Camera3Device::internalUpdateStatusLocked(Status status) {
}
}


void Camera3Device::pauseStateNotify(bool enable) {
void Camera3Device::pauseStateNotify(bool enable) {
    Mutex::Autolock il(mInterfaceLock);
    // We must not hold mInterfaceLock here since this function is called from
    // RequestThread::threadLoop and holding mInterfaceLock could lead to
    // deadlocks (http://b/143513518)
    Mutex::Autolock l(mLock);
    Mutex::Autolock l(mLock);


    mPauseStateNotify = enable;
    mPauseStateNotify = enable;
@@ -2742,7 +2744,9 @@ bool Camera3Device::reconfigureCamera(const CameraMetadata& sessionParams) {
    ATRACE_CALL();
    ATRACE_CALL();
    bool ret = false;
    bool ret = false;


    Mutex::Autolock il(mInterfaceLock);
    // We must not hold mInterfaceLock here since this function is called from
    // RequestThread::threadLoop and holding mInterfaceLock could lead to
    // deadlocks (http://b/143513518)
    nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
    nsecs_t maxExpectedDuration = getExpectedInFlightDuration();


    Mutex::Autolock l(mLock);
    Mutex::Autolock l(mLock);
@@ -5371,6 +5375,9 @@ bool Camera3Device::RequestThread::updateSessionParameters(const CameraMetadata&
bool Camera3Device::RequestThread::threadLoop() {
bool Camera3Device::RequestThread::threadLoop() {
    ATRACE_CALL();
    ATRACE_CALL();
    status_t res;
    status_t res;
    // Any function called from threadLoop() must not hold mInterfaceLock since
    // it could lead to deadlocks (disconnect() -> hold mInterfaceMutex -> wait for request thread
    // to finish -> request thread waits on mInterfaceMutex) http://b/143513518


    // Handle paused state.
    // Handle paused state.
    if (waitIfPaused()) {
    if (waitIfPaused()) {