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

Commit ad72add2 authored by Grigori Goronzy's avatar Grigori Goronzy Committed by Konsta
Browse files

FM Radio: avoid deadlock when disabling RDS

When RDS is being configured, the session mutex is hold. However,
when it is being disabled, RDS callbacks might still fire, and these
also try to hold the mutex, leading to a deadlock.

Temporary unlock the mutex while the vendor library is called to
work around.

Change-Id: Ic9751c7185fd8de4a7510225f54d23a22f042321
parent 2fc3d545
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1362,8 +1362,11 @@ static void androidFmRadioRxSetRDS(JNIEnv * env, jobject obj,
        /* if in pause state temporary resume */
        /* if in pause state temporary resume */
        androidFmRadioTempResumeIfPaused(&fmReceiverSession);
        androidFmRadioTempResumeIfPaused(&fmReceiverSession);


        /* temporary unlock to avoid deadlock with RDS callback */
        pthread_mutex_unlock(fmReceiverSession.dataMutex_p);
        retval = fmReceiverSession.vendorMethods_p->
        retval = fmReceiverSession.vendorMethods_p->
            set_rds_reception(&fmReceiverSession.vendorData_p, receiveRDS);
            set_rds_reception(&fmReceiverSession.vendorData_p, receiveRDS);
        pthread_mutex_lock(fmReceiverSession.dataMutex_p);


        androidFmRadioPauseIfTempResumed(&fmReceiverSession);
        androidFmRadioPauseIfTempResumed(&fmReceiverSession);
    } else {
    } else {