mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 12:28:13 -04:00
fix: race for statebuf_ in simple progress mode
This commit is contained in:
parent
9adf183117
commit
1590abbac3
@ -307,14 +307,13 @@ void console_writer::update(progress& p, bool last) {
|
||||
std::string tmp =
|
||||
fmt::format(" ==> {0:.0f}% done, {1} blocks/{2} written", 100 * frac_,
|
||||
p.blocks_written.load(), size_with_unit(p.compressed_size));
|
||||
std::lock_guard lock(log_mutex());
|
||||
if (tmp != statebuf_) {
|
||||
auto t = get_current_time_string();
|
||||
statebuf_ = tmp;
|
||||
std::lock_guard lock(log_mutex());
|
||||
log_stream() << "- " << t << statebuf_ << "\n";
|
||||
}
|
||||
if (last) {
|
||||
std::lock_guard lock(log_mutex());
|
||||
log_stream() << oss.str();
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user