Closed
Description
Hi,
master is currently not working properly when using LOG_EVERY_N
and threads
minimal example to reproduce:
#include <gflags/gflags.h>
#include <chrono>
#include <thread>
#include "glog/logging.h"
void f(int id) {
while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
LOG_EVERY_N(INFO, 10) << "test: " << id;
}
}
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
LOG(INFO) << "before threads";
std::thread t1(f, 0);
std::thread t2(f, 1);
t1.join();
t2.join();
}
This will only print for some time before stopping.
The current release does not experience this issue, so it's probably due to a regression.
context:
glog version: 503e3dec8d1fe071376befc62119a837c26612a3
compiler: g++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
bazel: 4.2.1
Activity