Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/reporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ class Reporter {
os.push(boost::iostreams::zstd_compressor());
os.push(sink);

while (!done || nstrings > 0) {
if (!os) {
fmt::print(std::cerr, "Error: Could not open {} for writing.\n", out_path);
}

while ((!done || nstrings > 0) && os) {
data_cond.wait_for(lk, std::chrono::seconds(1), [this] { return !string_queue.empty() || done; });
if (!string_queue.empty()) {
s = std::move(string_queue.front());
Expand All @@ -91,6 +95,10 @@ class Reporter {
lk.lock();
}
}

if (!os) {
fmt::print(std::cerr, "Error: Failure writing to {}.\n", out_path);
}
}

void print_debug() {
Expand Down Expand Up @@ -163,15 +171,15 @@ class Reporter {
std::unique_lock<std::mutex> lk(deb);
debug_queue.push(s);
lk.unlock();
debug_cond.notify_all();
debug_cond.notify_one();
return;
} else {
std::unique_lock<std::mutex> lk(mut);
string_queue.push(s);
nstrings++;
nsubmitted++;
lk.unlock();
data_cond.notify_all();
data_cond.notify_one();
}
}

Expand Down
Loading