1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-08-21 15:50:50 +00:00

Fix program hanging in release.

That great idea of spawning a thread for printing to stdout is
firing back. Temporary fix to get past, but the output looks
really broken now.
This commit is contained in:
King_DuckZ 2016-02-23 23:28:49 +01:00
parent b55f42e905
commit b19720548a

View file

@ -170,8 +170,9 @@ namespace {
std::size_t clear_size = 0; std::size_t clear_size = 0;
const auto digit_count = static_cast<std::size_t>(std::log10(static_cast<double>(total_items))) + 1; const auto digit_count = static_cast<std::size_t>(std::log10(static_cast<double>(total_items))) + 1;
do { do {
std::unique_lock<std::mutex> lk(progress_print); //TODO: fix this steaming pile of crap
parIndexer.step_notify().wait(lk); //std::unique_lock<std::mutex> lk(progress_print);
//parIndexer.step_notify().wait(lk);
std::cout << '\r'; std::cout << '\r';
std::fill_n(cout_iterator(std::cout), clear_size, ' '); std::fill_n(cout_iterator(std::cout), clear_size, ' ');
std::cout << '\r'; std::cout << '\r';
@ -186,7 +187,7 @@ namespace {
std::cout << msg; std::cout << msg;
std::cout.flush(); std::cout.flush();
} }
} while (parIndexer.processed_items() != total_items); } while (false); //parIndexer.processed_items() != total_items);
hash_thread.join(); hash_thread.join();
if (parIndexer.processed_items() > 0) { if (parIndexer.processed_items() > 0) {