OSDN Git Service

hci: Stop the thread before hci_close()
authorMyles Watson <mylesgw@google.com>
Tue, 14 Mar 2017 18:58:10 +0000 (11:58 -0700)
committerMyles Watson <mylesgw@google.com>
Tue, 14 Mar 2017 18:59:25 +0000 (11:59 -0700)
Bug:36026072
Test: Switch users (toggle Bluetooth under load)
Change-Id: I3fb901b5c47021c708c1fb548858406225065d00

hci/src/hci_layer.cc

index 6c9d79c..fae92d3 100644 (file)
@@ -226,13 +226,15 @@ static future_t* hci_module_shut_down() {
   alarm_free(startup_timer);
   startup_timer = NULL;
 
-  hci_close();
-
+  // Stop the thread to prevent Send() calls.
   if (thread) {
     thread_stop(thread);
     thread_join(thread);
   }
 
+  // Close HCI to prevent callbacks.
+  hci_close();
+
   fixed_queue_free(command_queue, osi_free);
   command_queue = NULL;
   fixed_queue_free(packet_queue, buffer_allocator->free);