bkcrack: src/cli/ConsoleProgress.hpp Source File

bkcrack 1.8.1 Crack legacy zip encryption with Biham and Kocher's known plaintext attack.

ConsoleProgress.hpp
1#ifndef BKCRACK_CONSOLEPROGRESS_HPP
2#define BKCRACK_CONSOLEPROGRESS_HPP
3
4#include <bkcrack/Progress.hpp>
5
6#include <condition_variable>
7#include <mutex>
8#include <thread>
9
11 class ConsoleProgress : public Progress
12{
13public:
15 explicit ConsoleProgress(std::ostream& os,
16 const std::chrono::milliseconds& interval = std::chrono::milliseconds{200});
17
19 ~ConsoleProgress();
20
21private:
22 const std::chrono::milliseconds m_interval;
23
24 std::mutex m_in_destructor_mutex;
25 std::condition_variable m_in_destructor_cv;
26 bool m_in_destructor;
27
28 std::thread m_printer;
29 void printerFunction();
30};
31
32#endif // BKCRACK_CONSOLEPROGRESS_HPP
ConsoleProgress::ConsoleProgress
ConsoleProgress(std::ostream &os, const std::chrono::milliseconds &interval=std::chrono::milliseconds{200})
Start a thread to print progress.
ConsoleProgress::~ConsoleProgress
~ConsoleProgress()
Notify and stop the printing thread.
Progress::Progress
Progress(std::ostream &os)
Constructor.