From 683c66d81898e1d7d4cb814a5740169529c3313e Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Mon, 19 Sep 2022 18:26:36 -0400 Subject: Scanning can now be cancelled. Fix terminate() of thread pool blocking if wait() is already called. --- qdeduper/filescanner.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qdeduper/filescanner.hpp') diff --git a/qdeduper/filescanner.hpp b/qdeduper/filescanner.hpp index 5d927a4..3df620e 100644 --- a/qdeduper/filescanner.hpp +++ b/qdeduper/filescanner.hpp @@ -1,6 +1,7 @@ #ifndef FILESCANNER_HPP #define FILESCANNER_HPP +#include #include #include #include @@ -16,11 +17,14 @@ class FileScanner : public QObject std::vector> paths; std::vector ret; std::size_t maxmnlen; + std::atomic interrpt; public: FileScanner(); void add_magic_number(const std::string &m); void add_path(const fs::path &p, bool recurse = false); void scan(); + void interrupt(); + bool interrupted(); std::vector file_list(); Q_SIGNALS: void scan_done_prep(std::size_t nfiles); -- cgit v1.2.3