Make thread names more meaningful
* Rename threads:
- module_wrapper -> bt_module_lifecycle_thread
- btif_a2dp_sink_worker_thread -> bt_a2dp_sink_worker_thread
- btif_a2dp_source_thread -> bt_a2dp_source_worker_thread
- bt_jni_workqueue -> bt_jni_thread
- stack_manager -> bt_stack_manager_thread
- hci_thread -> bt_hci_thread
- bt_workqueue -> bt_startup_thread
- btu_message_loop -> bt_main_thread
* Rename functions:
- do_in_bta_thread -> do_in_main_thread
- get_message_loop -> get_main_message_loop
- post_to_hci_message_loop -> post_to_main_message_loop
* Refactored bta_sys_sendmsg
Bug: 110303473
Test: make, unit test, stream music
Change-Id: I3051f6ea2d33db37af8eebafba7db4d1e113f611
diff --git a/main/bte_main.cc b/main/bte_main.cc
index f3cca3e..04e564f 100644
--- a/main/bte_main.cc
+++ b/main/bte_main.cc
@@ -91,22 +91,18 @@
*
* Function post_to_hci_message_loop
*
- * Description Post an HCI event to the hci message queue
+ * Description Post an HCI event to the main thread
*
* Returns None
*
*****************************************************************************/
-void post_to_hci_message_loop(const tracked_objects::Location& from_here,
- BT_HDR* p_msg) {
- base::MessageLoop* hci_message_loop = get_message_loop();
- if (!hci_message_loop || !hci_message_loop->task_runner().get()) {
- LOG_ERROR(LOG_TAG, "%s: HCI message loop not running, accessed from %s",
- __func__, from_here.ToString().c_str());
- return;
+void post_to_main_message_loop(const tracked_objects::Location& from_here,
+ BT_HDR* p_msg) {
+ if (do_in_main_thread(from_here, base::Bind(&btu_hci_msg_process, p_msg)) !=
+ BT_STATUS_SUCCESS) {
+ LOG(ERROR) << __func__ << ": do_in_main_thread failed from "
+ << from_here.ToString();
}
-
- hci_message_loop->task_runner()->PostTask(
- from_here, base::Bind(&btu_hci_msg_process, p_msg));
}
/******************************************************************************
@@ -127,7 +123,7 @@
return;
}
- hci->set_data_cb(base::Bind(&post_to_hci_message_loop));
+ hci->set_data_cb(base::Bind(&post_to_main_message_loop));
module_init(get_module(STACK_CONFIG_MODULE));
}