Commit 54421697 authored by 's avatar
parent 204ef03a
......@@ -745,7 +745,8 @@ void LogFileObject::Write(bool force_flush,
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;
......
......@@ -221,6 +221,15 @@ 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_FREEBSD || defined OS_MACOSX
......
......@@ -159,6 +159,7 @@ typedef double WallTime;
WallTime WallTime_Now();
int32 GetMainThreadPid();
bool PidHasChanged();
pid_t GetTID();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment