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

Commit a8b3cb11 authored by Myles Watson's avatar Myles Watson
Browse files

Remove unused is_on_main_thread

Bug: 289277431
Test: mma -j32
Change-Id: I83f4133c4c2a63325f9af746c6f6a3c801ecb1aa
parent 460d9fc6
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -111,22 +111,3 @@ void main_thread_start_up() {
}

void main_thread_shut_down() { main_thread.ShutDown(); }

bool is_on_main_thread() {
  // Pthreads doesn't have the concept of a thread ID, so we have to reach down
  // into the kernel.
#if defined(OS_MACOSX)
  return main_thread.GetThreadId() == pthread_mach_thread_np(pthread_self());
#elif defined(OS_LINUX)
#include <sys/syscall.h> /* For SYS_xxx definitions */
#include <unistd.h>
  return main_thread.GetThreadId() == syscall(__NR_gettid);
#elif defined(__ANDROID__)
#include <sys/types.h>
#include <unistd.h>
  return main_thread.GetThreadId() == gettid();
#else
  LOG(ERROR) << __func__ << "Unable to determine if on main thread";
  return true;
#endif
}
+0 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
                                      base::OnceClosure task,
                                      const base::TimeDelta& delay);

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

+0 −19
Original line number Diff line number Diff line
@@ -77,22 +77,3 @@ void sync_main_handler() {
  post_on_bt_main([&promise]() { promise.set_value(); });
  future.wait_for(std::chrono::milliseconds(sync_timeout_in_ms));
};

bool is_on_main_thread() {
  // Pthreads doesn't have the concept of a thread ID, so we have to reach down
  // into the kernel.
#if defined(OS_MACOSX)
  return main_thread.GetThreadId() == pthread_mach_thread_np(pthread_self());
#elif defined(OS_LINUX)
#include <sys/syscall.h> /* For SYS_xxx definitions */
#include <unistd.h>
  return main_thread.GetThreadId() == syscall(__NR_gettid);
#elif defined(__ANDROID__)
#include <sys/types.h>
#include <unistd.h>
  return main_thread.GetThreadId() == gettid();
#else
  LOG(ERROR) << __func__ << "Unable to determine if on main thread";
  return true;
#endif
}
+0 −1
Original line number Diff line number Diff line
@@ -37,4 +37,3 @@ void main_thread_shut_down();
extern int sync_timeout_in_ms;
void sync_main_handler();
bluetooth::common::MessageLoopThread* get_main_thread();
bool is_on_main_thread();