src/utilities: fix build without pthread

- Remove is_default_thread function which is an internal and not used
  function
- Remove g_main_thread_id as it was used only by is_default_thread

Fixes:
 - http://autobuild.buildroot.net/results/5320bbe1205e782e3516d9bead8d1ed825bcbaad

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
This commit is contained in:
Fabrice Fontaine 2019-10-31 19:27:16 +01:00 committed by Sergiu Deitsch
parent fd3dc2c633
commit 9630e0e848
2 changed files with 3 additions and 15 deletions

View File

@ -61,7 +61,6 @@ using std::string;
_START_GOOGLE_NAMESPACE_
static const char* g_program_invocation_short_name = NULL;
static pthread_t g_main_thread_id;
_END_GOOGLE_NAMESPACE_
@ -181,16 +180,6 @@ bool IsGoogleLoggingInitialized() {
return g_program_invocation_short_name != NULL;
}
bool is_default_thread() {
if (g_program_invocation_short_name == NULL) {
// InitGoogleLogging() not yet called, so unlikely to be in a different
// thread
return true;
} else {
return pthread_equal(pthread_self(), g_main_thread_id);
}
}
#ifdef OS_WINDOWS
struct timeval {
long tv_sec, tv_usec;
@ -276,9 +265,11 @@ pid_t GetTID() {
return getpid(); // Linux: getpid returns thread ID when gettid is absent
#elif defined OS_WINDOWS && !defined OS_CYGWIN
return GetCurrentThreadId();
#else
#elif defined(HAVE_PTHREAD)
// If none of the techniques above worked, we use pthread_self().
return (pid_t)(uintptr_t)pthread_self();
#else
return -1;
#endif
}
@ -350,7 +341,6 @@ void InitGoogleLoggingUtilities(const char* argv0) {
if (!slash) slash = strrchr(argv0, '\\');
#endif
g_program_invocation_short_name = slash ? slash + 1 : argv0;
g_main_thread_id = pthread_self();
#ifdef HAVE_STACKTRACE
InstallFailureFunction(&DumpStackTraceAndExit);

View File

@ -163,8 +163,6 @@ const char* ProgramInvocationShortName();
bool IsGoogleLoggingInitialized();
bool is_default_thread();
int64 CycleClock_Now();
int64 UsecToCycles(int64 usec);