aboutsummaryrefslogtreecommitdiff
path: root/qdeduper/filescanner.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-19 18:26:36 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-19 18:27:15 -0400
commit683c66d81898e1d7d4cb814a5740169529c3313e (patch)
tree2bd09916fce34141b3ce00822f816485fe1cc8dd /qdeduper/filescanner.hpp
parent817075ec9bd6bd656a4a6dc23363e950474b21d5 (diff)
downloaddeduper-683c66d81898e1d7d4cb814a5740169529c3313e.tar.xz
Scanning can now be cancelled.
Fix terminate() of thread pool blocking if wait() is already called.
Diffstat (limited to 'qdeduper/filescanner.hpp')
-rw-r--r--qdeduper/filescanner.hpp4
1 files changed, 4 insertions, 0 deletions
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 <atomic>
#include <filesystem>
#include <string>
#include <utility>
@@ -16,11 +17,14 @@ class FileScanner : public QObject
std::vector<std::pair<fs::path, bool>> paths;
std::vector<fs::path> ret;
std::size_t maxmnlen;
+ std::atomic<bool> 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<fs::path> file_list();
Q_SIGNALS:
void scan_done_prep(std::size_t nfiles);