StateFile: schedule timer only after a change

Save the state file 2 minutes after the last change.  This reduces the
disruptions by an idle MPD, and MPD can be paged out permanently until
it is used.
This commit is contained in:
Max Kellermann
2013-04-08 22:31:51 +02:00
parent 96882175f1
commit dca1115196
4 changed files with 15 additions and 18 deletions

View File

@@ -48,6 +48,11 @@ public:
void Read();
void Write();
/**
* Schedules a write if MPD's state was modified.
*/
void CheckModified();
private:
/**
* Save the current state versions for use with IsModified().
@@ -61,8 +66,6 @@ private:
gcc_pure
bool IsModified() const;
void AutoWrite();
/* virtual methods from TimeoutMonitor */
virtual bool OnTimeout() override;
};