1 --- base/message_loop/message_pump_glib.cc.orig	2022-08-31 12:19:35 UTC
2 +++ base/message_loop/message_pump_glib.cc
3 @@ -8,6 +8,11 @@
4  #include <glib.h>
5  #include <math.h>
6 
7 +#if BUILDFLAG(IS_BSD)
8 +#include <pthread.h>
9 +#include <pthread_np.h>
10 +#endif
11 +
12  #include "base/logging.h"
13  #include "base/memory/raw_ptr.h"
14  #include "base/notreached.h"
15 @@ -51,9 +56,13 @@ int GetTimeIntervalMilliseconds(TimeTicks next_task_ti
16  }
17 
18  bool RunningOnMainThread() {
19 +#if BUILDFLAG(IS_BSD)
20 +  return pthread_main_np();
21 +#else
22    auto pid = getpid();
23    auto tid = PlatformThread::CurrentId();
24    return pid > 0 && tid > 0 && pid == tid;
25 +#endif
26  }
27 
28  // A brief refresher on GLib:
29