Changeset View
Changeset View
Standalone View
Standalone View
plugins/scanfolder/scanthread.h
Show All 23 Lines | |||||
24 | #include <QMutex> | 24 | #include <QMutex> | ||
25 | #include <QStringList> | 25 | #include <QStringList> | ||
26 | #include <QThread> | 26 | #include <QThread> | ||
27 | #include <QUrl> | 27 | #include <QUrl> | ||
28 | 28 | | |||
29 | #include <util/ptrmap.h> | 29 | #include <util/ptrmap.h> | ||
30 | #include "scanfolder.h" | 30 | #include "scanfolder.h" | ||
31 | 31 | | |||
32 | #include <atomic> | ||||
32 | 33 | | |||
33 | class QDir; | 34 | class QDir; | ||
34 | 35 | | |||
35 | namespace kt | 36 | namespace kt | ||
36 | { | 37 | { | ||
37 | 38 | | |||
38 | /** | 39 | /** | ||
39 | * Thread which scans directories in the background and looks for torrent files. | 40 | * Thread which scans directories in the background and looks for torrent files. | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 82 | signals: | |||
83 | * Emitted when one or more torrents are found. | 84 | * Emitted when one or more torrents are found. | ||
84 | * @param torrents The list of torrents | 85 | * @param torrents The list of torrents | ||
85 | */ | 86 | */ | ||
86 | void found(const QList<QUrl>& torrents); | 87 | void found(const QList<QUrl>& torrents); | ||
87 | 88 | | |||
88 | private: | 89 | private: | ||
89 | QMutex mutex; | 90 | QMutex mutex; | ||
90 | QStringList folders; | 91 | QStringList folders; | ||
91 | bool stop_requested; | 92 | std::atomic<bool> stop_requested; | ||
92 | bool recursive; | 93 | std::atomic<bool> recursive; | ||
93 | bt::PtrMap<QString, ScanFolder> scan_folders; | 94 | bt::PtrMap<QString, ScanFolder> scan_folders; | ||
94 | }; | 95 | }; | ||
95 | 96 | | |||
96 | } | 97 | } | ||
97 | 98 | | |||
98 | #endif // KT_SCANTHREAD_H | 99 | #endif // KT_SCANTHREAD_H |