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

Commit 68fca3c9 authored by Grigori Goronzy's avatar Grigori Goronzy
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 042f135a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1362,8 +1362,11 @@ static void androidFmRadioRxSetRDS(JNIEnv * env, jobject obj,
        /* if in pause state temporary resume */
        androidFmRadioTempResumeIfPaused(&fmReceiverSession);

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

        androidFmRadioPauseIfTempResumed(&fmReceiverSession);
    } else {