mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-10 13:04:15 -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 =
|
std::string tmp =
|
||||||
fmt::format(" ==> {0:.0f}% done, {1} blocks/{2} written", 100 * frac_,
|
fmt::format(" ==> {0:.0f}% done, {1} blocks/{2} written", 100 * frac_,
|
||||||
p.blocks_written.load(), size_with_unit(p.compressed_size));
|
p.blocks_written.load(), size_with_unit(p.compressed_size));
|
||||||
|
std::lock_guard lock(log_mutex());
|
||||||
if (tmp != statebuf_) {
|
if (tmp != statebuf_) {
|
||||||
auto t = get_current_time_string();
|
auto t = get_current_time_string();
|
||||||
statebuf_ = tmp;
|
statebuf_ = tmp;
|
||||||
std::lock_guard lock(log_mutex());
|
|
||||||
log_stream() << "- " << t << statebuf_ << "\n";
|
log_stream() << "- " << t << statebuf_ << "\n";
|
||||||
}
|
}
|
||||||
if (last) {
|
if (last) {
|
||||||
std::lock_guard lock(log_mutex());
|
|
||||||
log_stream() << oss.str();
|
log_stream() << oss.str();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user