Windows: improve indexing process management. Fix Pidfile locking.

Use a stop file to request stop of indexing when the indexer was not
started from the current GUI instance.
This commit is contained in:
Jean-Francois Dockes
2019-02-14 14:12:08 +01:00
parent 0e866f1bce
commit 8853cb505a
5 changed files with 181 additions and 17 deletions
+6 -1
View File
@@ -111,6 +111,7 @@ class MyUpdater : public DbIxStatusUpdater {
public:
MyUpdater(const RclConfig *config)
: m_file(config->getIdxStatusFile().c_str()),
m_stopfilename(config->getIdxStopFile()),
m_prevphase(DbIxStatus::DBIXS_NONE) {
// The total number of files included in the index is actually
// difficult to compute from the index itself. For display
@@ -145,7 +146,10 @@ class MyUpdater : public DbIxStatusUpdater {
m_file.set("hasmonitor", status.hasmonitor);
m_file.holdWrites(false);
}
if (path_exists(m_stopfilename)) {
unlink(m_stopfilename.c_str());
stopindexing = true;
}
if (stopindexing) {
return false;
}
@@ -166,6 +170,7 @@ class MyUpdater : public DbIxStatusUpdater {
private:
ConfSimple m_file;
string m_stopfilename;
Chrono m_chron;
DbIxStatus::Phase m_prevphase;
};