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
  • Loading branch information...
grigorig authored and Gerrit Code Review committed Mar 2, 2013
1 parent 0429b4c commit 77c1d3420621201b28cf648652f1f2d410be31cd
Showing with 3 additions and 0 deletions.
  1. +3 −0 fmradio/jni/android_fmradio_Receiver.cpp
@@ -1362,8 +1362,11 @@ static void androidFmRadioRxSetRDS(JNIEnv * env, jobject obj,
/* if in pause state temporary resume */
+ /* 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);
} else {

0 comments on commit 77c1d34

Please sign in to comment.