Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 337f8f86 authored by Chris Manton's avatar Chris Manton
Browse files

Add bta_sys post to main alternative method

Toward eliminating BTA sys

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Id6b12b2d9744929ebb344fc1caf20c6a8015a525
parent af398873
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "btif/include/btif_common.h"
#include "btm_iso_api.h"
#include "common/message_loop_thread.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/btu.h"
@@ -106,6 +107,13 @@ bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
  return BT_STATUS_SUCCESS;
}

static void do_post_on_bt_main(BtMainClosure closure) { closure(); }

void post_on_bt_main(BtMainClosure closure) {
  ASSERT(do_in_main_thread(FROM_HERE,
                           base::Bind(do_post_on_bt_main, std::move(closure))));
}

void main_thread_start_up() {
  main_thread.StartUp();
  if (!main_thread.IsRunning()) {
+3 −0
Original line number Diff line number Diff line
@@ -59,4 +59,7 @@ bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
                                      base::OnceClosure task,
                                      const base::TimeDelta& delay);

using BtMainClosure = std::function<void()>;
void post_on_bt_main(BtMainClosure closure);

#endif