Updated thread locking to avoid deadlock scenario
Qualcomm submitted patch to address deadlock case when Rx
thread is processing a message while anthci->close is being called
diff --git a/src/qcomm-hidl/AntHidlClient.cpp b/src/qcomm-hidl/AntHidlClient.cpp
index 1baf140..fce47c4 100644
--- a/src/qcomm-hidl/AntHidlClient.cpp
+++ b/src/qcomm-hidl/AntHidlClient.cpp
@@ -198,13 +198,13 @@
if(anthci != nullptr)
{
- std::unique_lock< std::mutex> lock(ant_hci.data_mtx);
- ant_hci.data_cond.notify_all();
auto hidl_daemon_status = anthci->close();
if(!hidl_daemon_status.isOk())
{
ALOGE("%s: HIDL daemon is dead", __func__);
}
+ std::unique_lock< std::mutex> lock(ant_hci.data_mtx);
+ ant_hci.data_cond.notify_all();
}
ant_hci.state = ANT_RADIO_DISABLED;
ant_rx_clear();