http://code.google.com/p/google-glog/issues/detail?id=51
http://code.google.com/p/google-glog/issues/detail?id=74
http://code.google.com/p/google-glog/issues/detail?id=82
git-svn-id: https://google-glog.googlecode.com/svn/trunk@94
eb4d4688-79bd-11dd-afb4-
1d65580434c0
return;
}
- if (static_cast<int>(file_length_ >> 20) >= MaxLogSize()) {
+ if (static_cast<int>(file_length_ >> 20) >= MaxLogSize() ||
+ PidHasChanged()) {
if (file_ != NULL) fclose(file_);
file_ = NULL;
file_length_ = bytes_since_flush_ = 0;
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_FREEBSD || defined OS_MACOSX
WallTime WallTime_Now();
int32 GetMainThreadPid();
+bool PidHasChanged();
pid_t GetTID();