aboutsummaryrefslogtreecommitdiff
path: root/src/downloadthread.cpp
blob: c187d6a6270f1c2de1dbed810759e37d05d47f2c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "downloadthread.h"

#include "logger.h"

namespace newsboat {

DownloadThread::DownloadThread(Reloader& r, const std::vector<int>& idxs)
	: reloader(r), indexes(idxs) {}

DownloadThread::~DownloadThread() {}

void DownloadThread::operator()()
{
	/*
	 * the DownloadThread class drives the reload-all process.
	 * A DownloadThread is spawned whenever "reload all" is invoked, and
	 * whenever an auto-reload comes up.
	 */
	LOG(Level::DEBUG,
		"DownloadThread::run: inside DownloadThread, reloading all "
		"feeds...");
	if (reloader.trylock_reload_mutex()) {
		if (indexes.size() == 0) {
			reloader.reload_all();
		} else {
			reloader.reload_indexes(indexes);
		}
		reloader.unlock_reload_mutex();
	}
}

} // namespace newsboat