FM: fix rx thread syncronization
Change-Id: I6bab3de67c5bcb15d7661b5d63a53e6ef72de850
diff --git a/fm_hci/fm_hci.cpp b/fm_hci/fm_hci.cpp
index 4c4d285..0b442f1 100644
--- a/fm_hci/fm_hci.cpp
+++ b/fm_hci/fm_hci.cpp
@@ -97,12 +97,10 @@
static int enqueue_fm_rx_event(struct fm_event_header_t *hdr)
{
- hci.rx_queue_mtx.lock();
- hci.rx_event_queue.push(hdr);
- hci.rx_queue_mtx.unlock();
-
- ALOGI("%s: putting lock before notify", __func__);
+ ALOGI("%s: putting lock before enqueue ", __func__);
hci.rx_cond_mtx.lock();
+ ALOGI("%s: pushing event to que before notify", __func__);
+ hci.rx_event_queue.push(hdr);
ALOGI("%s:before notify to waiting thred", __func__);
hci.rx_cond.notify_all();
ALOGI("%s:after notify to waiting thred", __func__);
@@ -131,17 +129,14 @@
ALOGI("%s", __func__);
while (1) {
- hci.rx_queue_mtx.lock();
if (hci.rx_event_queue.empty()) {
ALOGI("No more FM Events are available in the RX Queue");
- hci.rx_queue_mtx.unlock();
return;
} else {
}
evt_buf = hci.rx_event_queue.front();
hci.rx_event_queue.pop();
- hci.rx_queue_mtx.unlock();
hci.credit_mtx.lock();
if (evt_buf->evt_code == FM_CMD_COMPLETE) {
diff --git a/fm_hci/fm_hci.h b/fm_hci/fm_hci.h
index 5c48827..73e1290 100644
--- a/fm_hci/fm_hci.h
+++ b/fm_hci/fm_hci.h
@@ -55,7 +55,6 @@
std::mutex rx_cond_mtx;
std::mutex tx_queue_mtx;
- std::mutex rx_queue_mtx;
std::mutex credit_mtx;
std::condition_variable cmd_credits_cond;