From 311898b36300f1341c9ac2bd1145d8e5332ffef3 Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Thu, 26 Apr 2018 13:56:43 +0200 Subject: [PATCH] added assertion thread exists --- src/compress.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/compress.cc b/src/compress.cc index b5406fb..2966ac0 100644 --- a/src/compress.cc +++ b/src/compress.cc @@ -3,19 +3,20 @@ * \brief Implementation of compression */ +#include "compress.hh" +#include "utf8.hh" +#include +#include +#include +#include +#include + #ifdef Debug constexpr bool debug_mode = true; #else constexpr bool debug_mode = false; #endif -#include "compress.hh" -#include "utf8.hh" -#include -#include -#include -#include - using dict_t = std::map, uint32_t>; using ustring = std::basic_string; // chaîne non encodée using uvec = std::vector; // chaîne encodée @@ -106,10 +107,10 @@ void compress(const std::string &t_in_file, const char *t_out_file) { std::vector chunk(32768, 0); while (input_file.read(chunk.data(), static_cast(chunk.size()))) { - printf("\n"); threads.emplace_back(nullptr, uvec{}); threads.back().first = std::make_unique( std::thread{lzw_compress, chunk, ref(threads.back().second)}); + assert(threads.back().first); if (threads.size() >= 8) { join_and_write(threads, out); }