libaudiohal@aidl: Fix deadlock when stream goes away
Split the lock for accessing 'DeviceHalAidl::mCallbacks' from the main lock 'DeviceHalAidl::mLock'. This is needed to handle the case when the code of 'Hal2AidlMapper' becomes the sole owner of the stream and ends up destroying it, triggering a callbacks cleanup call. Since all calls to 'Hal2AidlMapper' are protected by 'mLock', it can not be used for implementing exclusive access to 'mCallbacks'. To avoid introducing deadlocks due to use of two mutexes, the new mutex 'mCallbacksLock' is used only to guard access to 'mCallbacks', effectively making it a synchronized map. Bug: 357487484 Test: atest CoreAudioHalAidlTest Change-Id: Ic7e5314ad62954f9f8347af2049a5216cab01b7f
Loading
Please register or sign in to comment