diff options
Diffstat (limited to 'extern/libmv/third_party/glog/src/utilities.cc')
-rw-r--r-- | extern/libmv/third_party/glog/src/utilities.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/extern/libmv/third_party/glog/src/utilities.cc b/extern/libmv/third_party/glog/src/utilities.cc index 6d64b923703..27b2a905055 100644 --- a/extern/libmv/third_party/glog/src/utilities.cc +++ b/extern/libmv/third_party/glog/src/utilities.cc @@ -77,9 +77,11 @@ typedef void DebugWriter(const char*, void*); // For some environments, add two extra bytes for the leading "0x". static const int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*); -static void DebugWriteToStderr(const char* data, void *unused) { +static void DebugWriteToStderr(const char* data, void *) { // This one is signal-safe. - write(STDERR_FILENO, data, strlen(data)); + if (write(STDERR_FILENO, data, strlen(data)) < 0) { + // Ignore errors. + } } void DebugWriteToString(const char* data, void *arg) { @@ -221,9 +223,18 @@ int32 GetMainThreadPid() { return g_main_thread_pid; } +bool PidHasChanged() { + int32 pid = getpid(); + if (g_main_thread_pid == pid) { + return false; + } + g_main_thread_pid = pid; + return true; +} + pid_t GetTID() { // On Linux and FreeBSD, we try to use gettid(). -#if defined OS_LINUX || defined OS_MACOSX +#if defined OS_LINUX || defined OS_FREEBSD || defined OS_MACOSX #ifndef __NR_gettid #ifdef OS_MACOSX #define __NR_gettid SYS_gettid @@ -302,9 +313,7 @@ void SetCrashReason(const CrashReason* r) { r); } -} // namespace glog_internal_namespace_ - -void InitGoogleLogging(const char* argv0) { +void InitGoogleLoggingUtilities(const char* argv0) { CHECK(!IsGoogleLoggingInitialized()) << "You called InitGoogleLogging() twice!"; const char* slash = strrchr(argv0, '/'); @@ -319,14 +328,16 @@ void InitGoogleLogging(const char* argv0) { #endif } -void ShutdownGoogleLogging() { +void ShutdownGoogleLoggingUtilities() { CHECK(IsGoogleLoggingInitialized()) - << "You called ShutdownGoogleLogging() without InitGoogleLogging() first!"; + << "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!"; #ifdef HAVE_SYSLOG_H closelog(); #endif } +} // namespace glog_internal_namespace_ + _END_GOOGLE_NAMESPACE_ // Make an implementation of stacktrace compiled. |