MCPcopy Create free account
hub / github.com/IENT/YUView / VideoCache::loadingThread

Class VideoCache::loadingThread

YUViewLib/src/video/VideoCache.cpp:181–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179/// -------------------------- VideoCache::loadingThread --------------------
180
181class VideoCache::loadingThread : public QThread
182{
183 Q_OBJECT
184public:
185 loadingThread(QObject *parent) : QThread(parent)
186 {
187 // Create a new worker and move it to this thread
188 threadWorker.reset(new loadingWorker(nullptr));
189 threadWorker->moveToThread(this);
190 quitting = false;
191 }
192 void quitWhenDone()
193 {
194 quitting = true;
195 if (threadWorker->isWorking())
196 {
197 // We must wait until the worker is done.
198 DEBUG_CACHING("loadingThread::quitWhenDone waiting for worker to finish...");
199 connect(worker(), &loadingWorker::loadingFinished, this, [=] {
200 DEBUG_CACHING("loadingThread::quitWhenDone worker done -> quit");
201 quit();
202 });
203 }
204 else
205 {
206 DEBUG_CACHING("loadingThread::quitWhenDone quit now");
207 quit();
208 }
209 }
210 loadingWorker *worker() { return threadWorker.data(); }
211 bool isQuitting() { return quitting; }
212
213private:
214 QScopedPointer<loadingWorker> threadWorker;
215 bool quitting; // Are er quitting the job? If yes, do not push new jobs to it.
216};
217
218/// ---------------------------------- VideoCache ------------------------------
219

Callers

nothing calls this directly

Calls 1

loadingThreadClass · 0.85

Tested by

no test coverage detected